Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 15th, 2005, 7:29 AM   #1
JaDa64
Newbie
 
JaDa64's Avatar
 
Join Date: Apr 2005
Location: at home
Posts: 11
Rep Power: 0 JaDa64 is on a distinguished road
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.
JaDa64 is offline   Reply With Quote
Old Apr 15th, 2005, 11:58 AM   #2
ctor
Newbie
 
Join Date: Apr 2005
Location: Germany
Posts: 6
Rep Power: 0 ctor is on a distinguished road
Just call the 'Show' or 'ShowDialog' Method of the Form e.g.
Form2 f = new Form2();
f.ShowDialog();
Thats the code in c#, shouldn't be to hard to convert it in vb.

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.
ctor is offline   Reply With Quote
Old Apr 18th, 2005, 7:04 AM   #3
JaDa64
Newbie
 
JaDa64's Avatar
 
Join Date: Apr 2005
Location: at home
Posts: 11
Rep Power: 0 JaDa64 is on a distinguished road
thanks
JaDa64 is offline   Reply With Quote
Old Apr 18th, 2005, 9:10 AM   #4
JaDa64
Newbie
 
JaDa64's Avatar
 
Join Date: Apr 2005
Location: at home
Posts: 11
Rep Power: 0 JaDa64 is on a distinguished road
that makes a new form, i want a form called form 2 to show up, it is alreeady made.
JaDa64 is offline   Reply With Quote
Old Apr 18th, 2005, 12:06 PM   #5
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Form2.Show
Not hard, is it?
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Apr 19th, 2005, 7:55 AM   #6
JaDa64
Newbie
 
JaDa64's Avatar
 
Join Date: Apr 2005
Location: at home
Posts: 11
Rep Power: 0 JaDa64 is on a distinguished road
that doesnt work
JaDa64 is offline   Reply With Quote
Old Apr 19th, 2005, 11:38 AM   #7
ctor
Newbie
 
Join Date: Apr 2005
Location: Germany
Posts: 6
Rep Power: 0 ctor is on a distinguished road
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.
ctor is offline   Reply With Quote
Old Apr 19th, 2005, 11:47 AM   #8
Rory
Expert Programmer
 
Rory's Avatar
 
Join Date: Jan 2005
Location: London
Posts: 542
Rep Power: 4 Rory is on a distinguished road
Send a message via MSN to Rory
Is showing a form really this hard?
Rory is offline   Reply With Quote
Old Apr 19th, 2005, 4:19 PM   #9
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
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.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Apr 21st, 2005, 1:47 AM   #10
Bharathi
Programmer
 
Join Date: Apr 2005
Posts: 32
Rep Power: 0 Bharathi is on a distinguished road
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
Bharathi is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 10:13 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC