![]() |
How to link forms
Hi im relatively new to visual basic and i was wondering if anybody could help me. I'm trying to open a second form when i click a button on the first form, what is the code to do that. My programming teacher is to dumb and doesn't know how, so maybe you all could help. Thanks!
|
I'll help you! :) Just drop VB and turn to C++. ;)
|
Welcome to the Forums. Have you tried google-ing this? If not I suggest you do so. The next thing would be take up Jimmy's thought of learning C++. I will tell you this much. You create an object variable that references to the second form. So now you get to do some work and find out how to create a variable of an object of another form. It's quiet easy, I'll start it out for you: Dim mySecondForm as ___ _____ there you go, find out how to fill in those two blanks and you should be able to figure the rest out.
|
Hi,
I don't know Visual Basic but it's the same like in C#, so in C# I do something like shown below: :
and I converted the above code to VB.NET using developerfusion utility http://www.developerfusion.co.uk/uti...sharptovb.aspx to make the conversion and the VB code should look like below: :
As you can see I have commented .ShowDialog() method. With the .Show() method we can manipulate with two opened forms we can minimize Form1 work with Form2 or opposite, but when we use .ShowDialog() method, we cannot work in Form1 while the Form2 is shown, it is like a MessageBox we should close Form2 and continue working with Form1. But keep in mind, in our case here Form2 is child form of the Form1, so if you are using .Show dialog and if you close Form1 the Form2 will close. If you have further questions, or I didn't express so good, post a reply we hare here for this reason to help each other ;). |
Quote:
anyways... i think you need to hide the current form and show the target form using the methods already provided by the forms: currentform.hide targetform.show |
Stop telling him to learn a new language, it has nothing to do with his question and is not appriciated.
Quote:
:
Private Sub Command1_Click() |
Thanks alot everyone, well atleast everyone that helped me and didn't try to get me to learn C++. That's advanced programming in my school, and i'm not in that yet. Anyway thanks alot everyone you really helped!
|
| All times are GMT -5. The time now is 10:40 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC