|
-
Aug 6th, 2002, 11:12 AM
#1
Thread Starter
PowerPoster
*Resolved*What we used to do in VB6, to show a form?
form2.show
now if I have say a button(toolbar) and a menu item which calls his same form? on the clicks event - I just call formname.show. Thats it.
Come VB.NET
To display a form we use:
dim frm as new form2
frm.show
Prob: Now if some one clicks on the button twice or say once on the button and then in the menu item - then as many instances of form2 are created and displayed - how do I STOPPPPP this?
Last edited by veryjonny; Aug 9th, 2002 at 12:59 AM.
-
Aug 6th, 2002, 11:51 AM
#2
Hyperactive Member
Dont declare the new form there! You could declare your forms in a module instead!
Code:
Public Module TestModule
Public frm as new Form2
End Module
Public Class Form1
Public Sub LoadForm2
frm.Show
End Sub
End Class
I don't understand why so many people have trouble with this. I'm also a newbie at VB.NET (finnished my book just a couple of weeks ago).
-
Aug 7th, 2002, 02:52 AM
#3
Thread Starter
PowerPoster
hi
Me too a newbie.
But doesnt declaring the way u suggest load the form in memory even before I need it?
-
Aug 7th, 2002, 04:09 PM
#4
well if you dont need to access the form in the module then just do it all at once:
dim frm as new form2
frm.show
-
Aug 7th, 2002, 05:03 PM
#5
Hyperactive Member
Re: hi
Originally posted by veryjonny
Me too a newbie.
But doesnt declaring the way u suggest load the form in memory even before I need it?
I guess, but so what?
If you really need to, you could always check if the form has been loaded already.
Code:
Public Class Form1
Dim frm As Form2
Public Sub ShowForm
If frm Is Nothing Then
frm = new Form2();
End If
frm.Show
End Sub
End Class
-
Aug 8th, 2002, 01:01 PM
#6
Thread Starter
PowerPoster
yes. Thats what I was missing.
thanks
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|