Click here to Skip to main content
13,292,723 members (66,809 online)

Visual Basic

 
GeneralRe: TreeView Find not working Pin
treddie7-May-13 9:25
membertreddie7-May-13 9:25 
GeneralRe: TreeView Find not working Pin
Eddy Vluggen7-May-13 10:06
mvpEddy Vluggen7-May-13 10:06 
GeneralRe: TreeView Find not working Pin
treddie7-May-13 12:57
membertreddie7-May-13 12:57 
GeneralRe: TreeView Find not working Pin
Eddy Vluggen8-May-13 8:01
mvpEddy Vluggen8-May-13 8:01 
QuestionView the changes in the database by DATA SET... Pin
Vb Rnd4-May-13 7:23
memberVb Rnd4-May-13 7:23 
AnswerRe: View the changes in the database by DATA SET... Pin
Eddy Vluggen5-May-13 9:38
mvpEddy Vluggen5-May-13 9:38 
QuestionPathTooLongException and Solutions? Pin
treddie3-May-13 10:38
membertreddie3-May-13 10:38 
AnswerRe: PathTooLongException and Solutions? Pin
Eddy Vluggen5-May-13 10:43
mvpEddy Vluggen5-May-13 10:43 
GeneralRe: PathTooLongException and Solutions? Pin
treddie5-May-13 10:50
membertreddie5-May-13 10:50 
GeneralRe: PathTooLongException and Solutions? Pin
Eddy Vluggen5-May-13 11:04
mvpEddy Vluggen5-May-13 11:04 
QuestionHow do i save all opened windows Pin
Member 46241693-May-13 4:16
memberMember 46241693-May-13 4:16 
AnswerRe: How do i save all opened windows Pin
GuyThiebaut3-May-13 5:23
memberGuyThiebaut3-May-13 5:23 
QuestionHow do i save all opened windows Pin
Member 46241693-May-13 3:56
memberMember 46241693-May-13 3:56 
QuestionTry Catch does not Execute Catch code Pin
treddie2-May-13 19:31
membertreddie2-May-13 19:31 
Hi all.

I was trying this TreeView demo and ran into a situation where a Try Catch block will not pass execution onto the Catch code. The error is "Drive not ready" when attempting to access a:\. That is easy enough to understand...I have no floppy on my system. But why does the error handler not pass the error to the Catch area?

Many thanks for any advice!

Here is the demo:

A form just has a TreeView and a button on it. The demo populates a TreeView with the directories of my file system:

Public Class Form1
 
  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.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
      rootDir = drives(i).Name
 
      'Add this drive as a root node:
      TreeView1.Nodes.Add(rootDir)
 
      'Populate this root node:
      PopulateTreeView(rootDir, TreeView1.Nodes(i))
    Next
 
  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
          childNode = New TreeNode(folder)
          parentNode.Nodes.Add(childNode)
          PopulateTreeView(folder, childNode)
        Next
      End If
 
    Catch ex As UnauthorizedAccessException
      parentNode.Nodes.Add(folder & ": Access Denied")
 
    End Try
 
  End Sub
 
End Class


modified 3-May-13 3:17am.

AnswerRe: Try Catch does not Execute Catch code Pin
Richard MacCutchan2-May-13 22:41
mvpRichard MacCutchan2-May-13 22:41 
GeneralRe: Try Catch does not Execute Catch code Pin
treddie2-May-13 23:02
membertreddie2-May-13 23:02 
QuestionMethod signature does not match delegate - thread safe Pin
Member 100187622-May-13 8:12
memberMember 100187622-May-13 8:12 
AnswerRe: Method signature does not match delegate - thread safe Pin
Richard Deeming2-May-13 9:21
professionalRichard Deeming2-May-13 9:21 
GeneralRe: Method signature does not match delegate - thread safe Pin
Member 100187622-May-13 12:00
memberMember 100187622-May-13 12:00 
GeneralRe: Method signature does not match delegate - thread safe Pin
Alan N2-May-13 13:26
memberAlan N2-May-13 13:26 
QuestionTrouble passing arguments to System.Diagnostics.Process.Start Pin
savedlema2-May-13 1:07
membersavedlema2-May-13 1:07 
AnswerRe: Trouble passing arguments to System.Diagnostics.Process.Start Pin
Richard MacCutchan2-May-13 2:07
mvpRichard MacCutchan2-May-13 2:07 
GeneralRe: Trouble passing arguments to System.Diagnostics.Process.Start Pin
Richard Deeming2-May-13 2:23
professionalRichard Deeming2-May-13 2:23 
GeneralRe: Trouble passing arguments to System.Diagnostics.Process.Start Pin
Richard MacCutchan2-May-13 2:27
mvpRichard MacCutchan2-May-13 2:27 
GeneralRe: Trouble passing arguments to System.Diagnostics.Process.Start Pin
savedlema2-May-13 9:06
membersavedlema2-May-13 9:06 
AnswerRe: Trouble passing arguments to System.Diagnostics.Process.Start Pin
Eddy Vluggen2-May-13 6:07
mvpEddy Vluggen2-May-13 6:07 
AnswerRe: Trouble passing arguments to System.Diagnostics.Process.Start Pin
Alan N2-May-13 6:44
memberAlan N2-May-13 6:44 
GeneralRe: Trouble passing arguments to System.Diagnostics.Process.Start Pin
savedlema2-May-13 9:01
membersavedlema2-May-13 9:01 
GeneralRe: Trouble passing arguments to System.Diagnostics.Process.Start Pin
Alan N2-May-13 9:17
memberAlan N2-May-13 9:17 
GeneralRe: Trouble passing arguments to System.Diagnostics.Process.Start Pin
savedlema3-May-13 1:54
membersavedlema3-May-13 1:54 
GeneralRe: Trouble passing arguments to System.Diagnostics.Process.Start Pin
Alan N3-May-13 3:57
memberAlan N3-May-13 3:57 
GeneralRe: Trouble passing arguments to System.Diagnostics.Process.Start Pin
savedlema3-May-13 5:24
membersavedlema3-May-13 5:24 
QuestionWord VBA: quickly checking if table is uniform from 3rd row on Pin
Bart Van Eyndhoven2-May-13 0:08
memberBart Van Eyndhoven2-May-13 0:08 
AnswerRe: Word VBA: quickly checking if table is uniform from 3rd row on Pin
Kenneth Haugland2-May-13 3:28
professionalKenneth Haugland2-May-13 3:28 
QuestionRe: Word VBA: quickly checking if table is uniform from 3rd row on Pin
Kenneth Haugland2-May-13 3:37
professionalKenneth Haugland2-May-13 3:37 
AnswerRe: Word VBA: quickly checking if table is uniform from 3rd row on Pin
Bart Van Eyndhoven2-May-13 5:23
memberBart Van Eyndhoven2-May-13 5:23 
GeneralRe: Word VBA: quickly checking if table is uniform from 3rd row on Pin
Kenneth Haugland2-May-13 5:54
professionalKenneth Haugland2-May-13 5:54 
GeneralRe: Word VBA: quickly checking if table is uniform from 3rd row on Pin
Bart Van Eyndhoven2-May-13 22:51
memberBart Van Eyndhoven2-May-13 22:51 
AnswerRe: Word VBA: quickly checking if table is uniform from 3rd row on Pin
TnTinMn4-May-13 6:33
memberTnTinMn4-May-13 6:33 
QuestionVB Macro one sheet is corrupt Pin
saurabhrahulsharma1-May-13 17:59
membersaurabhrahulsharma1-May-13 17:59 
AnswerRe: VB Macro one sheet is corrupt Pin
jan212r1-May-13 21:31
memberjan212r1-May-13 21:31 
AnswerRe: VB Macro one sheet is corrupt Pin
Kenneth Haugland2-May-13 2:24
professionalKenneth Haugland2-May-13 2:24 
QuestionHow can i Change Button Label Value Randomly in VIRTUAL KEYBOARD ??? Pin
Vivek1987agarwal1-May-13 11:03
memberVivek1987agarwal1-May-13 11:03 
AnswerRe: How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD ??? Pin
dusty_dex1-May-13 12:24
memberdusty_dex1-May-13 12:24 
GeneralRe: How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD ??? Pin
Vivek1987agarwal1-May-13 21:49
memberVivek1987agarwal1-May-13 21:49 
GeneralRe: How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD ??? Pin
Richard MacCutchan1-May-13 22:24
mvpRichard MacCutchan1-May-13 22:24 
GeneralRe: How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD ??? Pin
Vivek1987agarwal1-May-13 22:30
memberVivek1987agarwal1-May-13 22:30 
GeneralRe: How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD ??? Pin
Richard MacCutchan1-May-13 23:04
mvpRichard MacCutchan1-May-13 23:04 
QuestionSQL working in SQLPlus but not returning rows in VB.net using Oracle.OLEDB provider Pin
liona1-May-13 4:14
memberliona1-May-13 4:14 
AnswerRe: SQL working in SQLPlus but not returning rows in VB.net using Oracle.OLEDB provider Pin
Simon_Whale1-May-13 4:24
professionalSimon_Whale1-May-13 4:24 

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.


Advertise | Privacy |
Web01 | 2.8.171207.1 | Last Updated 13 Dec 2017
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid