Click here to Skip to main content
15,890,438 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: cascading comboboxes vb.net windows forms Pin
Simon_Whale7-May-13 1:30
Simon_Whale7-May-13 1:30 
AnswerRe: cascading comboboxes vb.net windows forms Pin
Dave Kreskowiak7-May-13 1:44
mveDave Kreskowiak7-May-13 1:44 
GeneralRe: cascading comboboxes vb.net windows forms Pin
Agontuk9-May-13 8:53
Agontuk9-May-13 8:53 
QuestionHow to export the data from datagridview & all the data on the form1.vb make a report Pin
chandan H T5-May-13 1:24
chandan H T5-May-13 1:24 
AnswerRe: How to export the data from datagridview & all the data on the form1.vb make a report Pin
Eddy Vluggen5-May-13 8:49
professionalEddy Vluggen5-May-13 8:49 
QuestionTreeView Find not working Pin
treddie4-May-13 22:17
treddie4-May-13 22:17 
AnswerRe: TreeView Find not working Pin
Eddy Vluggen5-May-13 8:45
professionalEddy Vluggen5-May-13 8:45 
GeneralRe: TreeView Find not working Pin
treddie5-May-13 9:44
treddie5-May-13 9:44 
Hm...I like that solution MUCH better. But in the interests of trying to understand why "my" version won't work (it was an online TreeView demo that I modified slightly), no, it was a fully recursive method. Please see code below:

VB
Public Class Form1

  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Go_cmd.Click
    'Get a list of drives:
    Dim drives As System.Collections.ObjectModel.ReadOnlyCollection(Of IO.DriveInfo) = My.Computer.FileSystem.Drives
    Dim rootDir As String = String.Empty

    'Now loop thru each drive and populate the treeview:
    For i As Integer = 0 To drives.Count - 1
      System.Windows.Forms.Application.DoEvents()

      rootDir = drives(i).Name

      'Add this drive as a root node:
      TreeView1.Nodes.Add(rootDir)

      'Populate this root node:
      PopulateTreeView(rootDir, TreeView1.Nodes(i))
NextDrive:
    Next i

  End Sub

  Private Sub PopulateTreeView(ByVal dir As String, ByVal parentNode As TreeNode)
    Dim folder As String = String.Empty

    Try
      Dim folders() As String = IO.Directory.GetDirectories(dir)

      If folders.Length <> 0 Then
        Dim childNode As TreeNode = Nothing

        For Each folder In folders
          System.Windows.Forms.Application.DoEvents()

          childNode = New TreeNode(folder)
          parentNode.Nodes.Add(childNode)
          PopulateTreeView(folder, childNode)
        Next folder
      End If

    Catch ex As System.IO.IOException
      parentNode.Nodes.Add(folder & ": Drive not Ready")

    Catch ex As UnauthorizedAccessException
      parentNode.Nodes.Add(folder & ": Access Denied")
    End Try

  End Sub



  Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect

    If Text <> String.Empty Then
      Dim arr As TreeNode() = TreeView1.Nodes.Find("Client Supplied Files", True)

      For i = 0 To arr.Length - 1
        TreeView1.SelectedNode = arr(i)
      Next
    End If

End Sub

End Class

GeneralRe: TreeView Find not working Pin
Eddy Vluggen5-May-13 10:06
professionalEddy Vluggen5-May-13 10:06 
GeneralRe: TreeView Find not working Pin
treddie5-May-13 14:51
treddie5-May-13 14:51 
GeneralRe: TreeView Find not working Pin
JR2125-May-13 20:55
JR2125-May-13 20:55 
GeneralRe: TreeView Find not working Pin
treddie5-May-13 23:02
treddie5-May-13 23:02 
AnswerRe: TreeView Find not working Pin
Eddy Vluggen6-May-13 7:45
professionalEddy Vluggen6-May-13 7:45 
GeneralRe: TreeView Find not working Pin
treddie6-May-13 11:02
treddie6-May-13 11:02 
GeneralRe: TreeView Find not working Pin
Eddy Vluggen7-May-13 0:33
professionalEddy Vluggen7-May-13 0:33 
GeneralRe: TreeView Find not working Pin
treddie7-May-13 8:25
treddie7-May-13 8:25 
GeneralRe: TreeView Find not working Pin
Eddy Vluggen7-May-13 9:06
professionalEddy Vluggen7-May-13 9:06 
GeneralRe: TreeView Find not working Pin
treddie7-May-13 11:57
treddie7-May-13 11:57 
GeneralRe: TreeView Find not working Pin
Eddy Vluggen8-May-13 7:01
professionalEddy Vluggen8-May-13 7:01 
QuestionView the changes in the database by DATA SET... Pin
Ebrahem B Alabdaly4-May-13 6:23
Ebrahem B Alabdaly4-May-13 6:23 
AnswerRe: View the changes in the database by DATA SET... Pin
Eddy Vluggen5-May-13 8:38
professionalEddy Vluggen5-May-13 8:38 
QuestionPathTooLongException and Solutions? Pin
treddie3-May-13 9:38
treddie3-May-13 9:38 
AnswerRe: PathTooLongException and Solutions? Pin
Eddy Vluggen5-May-13 9:43
professionalEddy Vluggen5-May-13 9:43 
GeneralRe: PathTooLongException and Solutions? Pin
treddie5-May-13 9:50
treddie5-May-13 9:50 
GeneralRe: PathTooLongException and Solutions? Pin
Eddy Vluggen5-May-13 10:04
professionalEddy Vluggen5-May-13 10:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.