(VS2010) help??
#1

(if this is not the forum or thread plz remove this topic)

here is the stuff

-----------------------------

Hey!

im new to this and i really want to know how to get the things separated. i get the bug that if i got to a folder it shows the both Items

It looks like this:

(THE IMG IS TO BIG SO U NEED TO CLICK THIS TEXT)


plz help?

here is the code
Код:
Imports System.Diagnostics
Imports System.Windows.Forms

Public Class Servers

    Private Sub Explorer1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Set up the UI
        SetUpListViewColumns()
        LoadTree()
    End Sub

    Private Sub LoadTree()
        ' TODO: Add code to add items to the treeview

        Dim tvRoot As TreeNode
        Dim tvNode As TreeNode

        tvRoot = Me.TreeView.Nodes.Add("Servers")
        tvNode = tvRoot.Nodes.Add("Texten Chat [OFFICIAL CHAT]")
        tvNode = tvRoot.Nodes.Add("TreeItem2")
    End Sub

    Private Sub LoadListView()
        ' TODO: Add code to add items to the listview based on the selected item in the treeview

        Dim lvItem As ListViewItem
        ListView.Items.Clear()

        lvItem = ListView.Items.Add("90.224.231.42")
        lvItem.SubItems.AddRange(New String() {"Yes", "http://jonnys-bgs.ucoz.net/updater.html"})

    End Sub

    Private Sub SetUpListViewColumns()

        ' TODO: Add code to set up listview columns
        Dim lvColumnHeader As ColumnHeader

        ' Setting Column widths applies only to the current view, so this line
        '  explicitly sets the ListView to be showing the SmallIcon view
        '  before setting the column width
        SetView(View.SmallIcon)

        lvColumnHeader = ListView.Columns.Add("IP")
        ' Set the SmallIcon view column width large enough so that the items
        '  do not overlap
        ' Note that the second and third column do not appear in SmallIcon
        '  view, so there is no need to set those while in SmallIcon view
        lvColumnHeader.Width = 90

        ' Change the view to Details and set up the appropriate column
        '  widths for the Details view differently than SmallIcon view
        SetView(View.Details)

        ' The first column needs to be slightly larger in Details view than it
        '  was for SmallIcon view, and Column2 and Column3 need explicit sizes
        '  set for Details view
        lvColumnHeader.Width = 100

        lvColumnHeader = ListView.Columns.Add("Public")
        lvColumnHeader.Width = 70

        lvColumnHeader = ListView.Columns.Add("Website")
        lvColumnHeader.Width = 70

    End Sub

    Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        'Close this form
        Me.Close()
    End Sub

    Private Sub ToolBarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolBarToolStripMenuItem.Click
        'Toggle the visibility of the toolstrip and also the checked state of the associated menu item
        ToolBarToolStripMenuItem.Checked = Not ToolBarToolStripMenuItem.Checked
        ToolStrip.Visible = ToolBarToolStripMenuItem.Checked
    End Sub

    Private Sub StatusBarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles StatusBarToolStripMenuItem.Click
        'Toggle the visibility of the statusstrip and also the checked state of the associated menu item
        StatusBarToolStripMenuItem.Checked = Not StatusBarToolStripMenuItem.Checked
        StatusStrip.Visible = StatusBarToolStripMenuItem.Checked
    End Sub

    'Change whether or not the folders pane is visible
    Private Sub ToggleFoldersVisible()
        'First toggle the checked state of the associated menu item
        Folde*******tripMenuItem.Checked = Not Folde*******tripMenuItem.Checked

        'Change the Folders toolbar button to be in sync
        Folde*******tripButton.Checked = Folde*******tripMenuItem.Checked

        ' Collapse the Panel containing the TreeView.
        Me.SplitContainer.Panel1Collapsed = Not Folde*******tripMenuItem.Checked
    End Sub

    Private Sub Folde*******tripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Folde*******tripMenuItem.Click
        ToggleFoldersVisible()
    End Sub

    Private Sub Folde*******tripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Folde*******tripButton.Click
        ToggleFoldersVisible()
    End Sub

    Private Sub SetView(ByVal View As System.Windows.Forms.View)
        'Figure out which menu item should be checked
        Dim MenuItemToCheck As ToolStripMenuItem = Nothing
        Select Case View
            Case View.Details
                MenuItemToCheck = DetailsToolStripMenuItem
            Case View.LargeIcon
                MenuItemToCheck = LargeIconsToolStripMenuItem
            Case View.List
                MenuItemToCheck = ListToolStripMenuItem
            Case View.SmallIcon
                MenuItemToCheck = SmallIconsToolStripMenuItem
            Case View.Tile
                MenuItemToCheck = TileToolStripMenuItem
            Case Else
                Debug.Fail("Unexpected View")
                View = View.Details
                MenuItemToCheck = DetailsToolStripMenuItem
        End Select

        'Check the appropriate menu item and deselect all others under the Views menu
        For Each MenuItem As ToolStripMenuItem In ListViewToolStripButton.DropDownItems
            If MenuItem Is MenuItemToCheck Then
                MenuItem.Checked = True
            Else
                MenuItem.Checked = False
            End If
        Next

        'Finally, set the view requested
        ListView.View = View
    End Sub

    Private Sub ListToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListToolStripMenuItem.Click
        SetView(View.List)
    End Sub

    Private Sub DetailsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DetailsToolStripMenuItem.Click
        SetView(View.Details)
    End Sub

    Private Sub LargeIconsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LargeIconsToolStripMenuItem.Click
        SetView(View.LargeIcon)
    End Sub

    Private Sub SmallIconsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SmallIconsToolStripMenuItem.Click
        SetView(View.SmallIcon)
    End Sub

    Private Sub TileToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TileToolStripMenuItem.Click
        SetView(View.Tile)
    End Sub

    Private Sub TreeView_AfterSelect(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView.AfterSelect
        ' TODO: Add code to change the listview contents based on the currently-selected node of the treeview
        LoadListView()
    End Sub



    Private Sub SaveAsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub


End Class
Reply
#2

Wait, you want to show the user only one node (folder) or what?
Reply
#3

EDIT:

wtf. double post? O_o
Reply
#4

okay.

when i open the Server Form it shows the Items right away. and i can't get the to disapear.

here is a video

[ame="http://www.youtube.com/watch?v=4l8jTIN9UDQ"]HELP D:[/ame]

(used the same vid on the VBForums)
Reply
#5

Well, I hope I understand what you want. I'm no expert in this and I haven't used VB for months so I may be wrong:

Quote:

tvNode = tvRoot.Nodes.Add("Texten Chat [OFFICIAL CHAT]")
tvNode = tvRoot.Nodes.Add("TreeItem2")

I see you made a varaible called tvNode. Try renaming the second node to tvNode2 (also, don't forget to make it first with "Dim tvNode2 as TreeNode"). Then you would be able to hide it somehow.
Reply
#6

it still show when u start the Servers Form.

i want the String on the Texten Chat [OFFICIAL CHAT] folder not on root or node2

NODES
Код:
    Private Sub LoadTree()
        ' TODO: Add code to add items to the treeview

        Dim tvRoot As TreeNode
        Dim tvNode As TreeNode
        Dim tvNode2 As TreeNode

        tvRoot = Me.TreeView.Nodes.Add("Servers")
        tvNode = tvRoot.Nodes.Add("Texten Chat [OFFICIAL CHAT]")
        tvNode2 = tvRoot.Nodes.Add("TreeItem2")
    End Sub
STRING
Код:
    Private Sub LoadListView()
        ' TODO: Add code to add items to the listview based on the selected item in the treeview

        Dim lvItem As ListViewItem
        ListView.Items.Clear()

        lvItem = ListView.Items.Add("90.224.231.42")
        lvItem.SubItems.AddRange(New String() {"Yes", "http://jonnys-bgs.ucoz.net/updater.html"})

    End Sub
Reply
#7

Wait, I think I get it. You have this "Texten chat" node, and you want to show the IP and other info of that right box only if "texten chat" node is selected? If that's right, there's a function ("Private Sub...") when a node is selected (if I'm correct, I know I was experimenting with that). Just compare the selected node with title you set.

Sorry but I don't remember how it goes in VB.
Reply
#8

i don't know how to make it private sub
Reply
#9

Umm, I don't know if this can be done. This is your part of code:
Quote:

Private Sub TreeView_AfterSelect(ByVal sender As Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView.AfterSelect
' TODO: Add code to change the listview contents based on the currently-selected node of the treeview
LoadListView()
End Sub

Make it to somehow get the title of the currently selected node. Then, make a couple of "if" statements. If the title matches the title under which something would be shown, show it, else hide it.


Basic example (I don't know if you can get the current's selected node title + may not work, it's hard to remember it from the head):
Quote:

if CurrentSelectedNode.Title = "TEXTEN CHAT" then
Button1.Show
else
Button2.Hide

Reply
#10

ok, thanks.


and i just watched a tutorial

Код:
If e.Node.name = "node0" Then
Richtextbox1.Text = "To view a Servers IP, Description and if its public or private please click on a category"
Else
Richtextbox1.Text = ""
End if
simple now
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)