![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Apr 2005
Location: at home
Posts: 11
Rep Power: 0
![]() |
Button control to link two forms
i want a button to open a form called form2 but how do i do that. i know how to do so in VB6 but not in 2003 please help
Last edited by JaDa64; Apr 15th, 2005 at 8:40 AM. |
|
|
|
|
|
#2 |
|
Newbie
Join Date: Apr 2005
Location: Germany
Posts: 6
Rep Power: 0
![]() |
Just call the 'Show' or 'ShowDialog' Method of the Form e.g.
Form2 f = new Form2(); f.ShowDialog(); The difference between 'Show' and 'ShowDialog' is that 'ShowDialog' shows the called form modal. So you cant access the mainform as long as the called form isnt closed. If you want to exchange data between the two forms you have to pass them in the constructor of 'Form2' or write some public properties. |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Apr 2005
Location: at home
Posts: 11
Rep Power: 0
![]() |
thanks
|
|
|
|
|
|
#4 |
|
Newbie
Join Date: Apr 2005
Location: at home
Posts: 11
Rep Power: 0
![]() |
that makes a new form, i want a form called form 2 to show up, it is alreeady made.
|
|
|
|
|
|
#5 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Form2.Show |
|
|
|
|
|
#6 |
|
Newbie
Join Date: Apr 2005
Location: at home
Posts: 11
Rep Power: 0
![]() |
that doesnt work
|
|
|
|
|
|
#7 |
|
Newbie
Join Date: Apr 2005
Location: Germany
Posts: 6
Rep Power: 0
![]() |
Well actually Ooble's 'Form2.Show' cant work as long as you havent a static/shared method in your class 'Form2' called 'Show'.
You have to call 'Show' from a created instance of the class 'Form2'. I think its in VB.NET something like this: Dim formInstance As Form2 = New Form2 // class member formInstance.Show() // call this in a method
__________________
I dont care if it works on your machine, we are not shipping your machine. |
|
|
|
|
|
#8 |
|
Expert Programmer
|
Is showing a form really this hard?
|
|
|
|
|
|
#9 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Apparently so. If the form has already been created, it should be easy. My dog could do it. And I don't even have a dog.
|
|
|
|
|
|
#10 |
|
Programmer
Join Date: Apr 2005
Posts: 32
Rep Power: 0
![]() |
Button control to link two forms
Hi,
In the Form1, write the code for the okbutton_click() event as shown below. Private Sub okbutton_Click() Load Form2 Form2.Caption="This is second form" Form2.Show End Sub LOg on to :http://www.vkinfotek.com |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|