How do i make a program open a compomnent in visual basic in a click event?
I am new to using visual basic making a program. i was wondering if someone could tell me how to make the program open a component of the project using a click event. thank you
Update:i am using visual basic .net and when i say component i mean a form in a project.
Comments
I'm not quite sure what you're asking for.. what do you mean by a "component of the project"?
Also, is it VB6 or .NET, because that makes a big difference?
Edit:
Thanks for the additional info. I've not messed much with VB.NET... I've done a lot of VB6, VBA, and C#. However, assuming that VB.NET follows kind of a combined VB6 and .NET style...
Assuming you have a form named Form2 that you want to open when clicking something [button or whatever] on Form1. Add an the click event.. using the form designer click on whatever it is you want to be able to click to open the new window.. so if it's a button, click that button, if it is the form, click the form. Then in the properties box click the little lightning bolt to get to events, double click next to the "click" event. That will add all the event handling code you need to handle the click event. Then within the click event function put (and again I'm hoping that meshing VB6 methods with .NET is proper):
Dim anInstanceOfForm2 as new Form2
anInstanceOfForm2.Show()