Things were going good, but now it seems when the treeview loads I get an error
Here is the functionCode:System.NullReferenceException: Object reference not set to an instance of an object. at AppWindow.Form1.tvFolders_AfterSelect(Object sender, TreeViewEventArgs e) at System.Windows.Forms.TreeView.TvnSelected(NMTREEVIEW* nmtv) at System.Windows.Forms.TreeView.WmNotify(Message& m) at System.Windows.Forms.TreeView.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
I cannot get the error in debug mode.Code:Private Sub tvFolders_AfterSelect(ByVal sender As System.Object, ByVal e As System.Windows.Forms.TreeViewEventArgs) Handles tvFolders.AfterSelect curNode = e.Node Dim root1 As Boolean = False Try If curNode.Text = "Jackson County" Then root1 = True ElseIf curNode.Text = "Personal" Then MnuFDelete.Enabled = False lvFiles.Items.Clear() Exit Sub Else curNode.Tag = appPath & curNode.Text & "\" End If If curNode.Tag.ToString.Length < 1 Then MsgBox("appPath empty") End If If curNode.Level = 0 Then curNode.ImageIndex = 2 curNode.SelectedImageIndex = 2 Else curNode.ImageIndex = 0 curNode.SelectedImageIndex = 1 End If If Not curNode.Text = "Personal" Then ' Find all the files in the currentlty selected directory objFS.ListFoldersFiles(curNode.Tag, lvFiles, ImageList2) End If If My.Settings.Favorites.Contains(curNode.Text) Then MnuFDelete.Enabled = True If lvFiles.Items.Count < 1 Then lvFiles.Items.Clear() End If Else MnuFDelete.Enabled = False End If lvFiles.Sort() lvFiles.Columns(0).AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent) lvFiles.Columns(2).AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent) Catch ex As Exception Debug.WriteLine(ex.Message) MsgBox("Select Failed" & Chr(13) & Chr(13) & ex.Message, vbOKOnly, "Failed To Select") End Try End Sub




Reply With Quote