Search
VB
-
Tips
Visual Basic .Net tips and tricks
1
Previous
Next
TreeView: As a menu to show forms
Showing a form using a treeview as the menu for that
Needs only a Treeview on a form (1) and two extra forms (2 and 3)
Private Sub Form1_Load(ByVal sender As _
System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.TreeView1.Nodes.AddRange(New System.Windows.Forms.TreeNode() _
{New System.Windows.Forms.TreeNode("MyForms", _
New System.Windows.Forms.TreeNode() _
{New System.Windows.Forms.TreeNode("Form2"), _
New System.Windows.Forms.TreeNode("Form3")})})
Me.TreeView1.SelectedImageIndex = -1
Me.TreeView1.Nodes(0).Nodes(0).Tag = New Form2
Me.TreeView1.Nodes(0).Nodes(1).Tag = New Form3
End Sub
Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.TreeViewEventArgs) _
Handles TreeView1.AfterSelect
If Not e.Node.Tag Is Nothing Then
Dim frm As Form = DirectCast(e.Node.Tag, Form)
frm.ShowDialog()
frm.Dispose()
End If
End Sub
1
Previous
Next
Syndication
Rss feed
Select a Category
General Grid Tips
DataGrid Tips
DataGridView Tips
Windows Forms Controls
General Ado.Net Tips
SqlClient Ado.Net Tips
OleDB Ado.Net Tips
Asp.Net Tips
Miscellanous Tips
Vista programming Tips
WPF Tips
Silverlight
Articles
Links
Code Camp
FAQs
VB Related Websites
Microsoft Visual Basic Home Page
Visual Basic .Net Wikipedia Page
Visual Basic Forums
Visual Basic Newsgroup
VB City
Thinq Linq
VB Helper
I love VB