Link Label to open a new window

MissABC

New member
Joined
Feb 27, 2008
Messages
2
Programming Experience
Beginner
How do I get a label when clicked to open a new window. This window will be populated with a list from the database and the user should be able to select from a list.

Thanks
 
Moved to Windows Forms

Label's have a click event, but in this case I would use a LinkLabel which also has a click event. What you would do is make a new instance of the window then show it to the user.
 
Thanks, but I am very new to this. Could you tell me how to make a new instance of a window and then populate that with data from the database.
 
Usually I have a class/module level variable for the form, so at the top I have this line:
VB.NET:
Private TheForm As YourForm

Then in the click event of the label or the LinkClicked event of the linklabel put this:
VB.NET:
TheForm = New YourForm
TheForm.Show()
-or-
TheForm.ShowDialog() 'The program freezes for this form on this line until your dialog form is closed
The code for the database would be on the form that's being opened
 
Back
Top