|
-
Jul 30th, 2004, 11:46 AM
#1
Thread Starter
Frenzied Member
Very Basic Question --> Resolved
Hi all, How do I load, or call a form from a module?
Rudy
Last edited by RudyL; Jul 30th, 2004 at 12:54 PM.
10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".
-
Jul 30th, 2004, 12:08 PM
#2
Frenzied Member
Something like this?
VB Code:
Dim f as New Form1()
f.Show()
-
Jul 30th, 2004, 12:14 PM
#3
Thread Starter
Frenzied Member
Originally posted by Mike Hildner
Something like this?
VB Code:
Dim f as New Form1()
f.Show()
Does that create a new form or load the form called form1?
10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".
-
Jul 30th, 2004, 12:22 PM
#4
Frenzied Member
The first line does a couple things. It Dim's a variable named f as a type Form1. It also instantiates an instance of the class Form1, by calling the default, no argument constructor, and assigns that instance to the variable f.
The second line shows the form. This would cause the form to fire it's Form1_Load method.
Could also be written like this:
VB Code:
Dim f as Form1
f = New Form1()
f.Show()
-
Jul 30th, 2004, 12:33 PM
#5
Thread Starter
Frenzied Member
Originally posted by Mike Hildner
The first line does a couple things. It Dim's a variable named f as a type Form1. It also instantiates an instance of the class Form1, by calling the default, no argument constructor, and assigns that instance to the variable f.
The second line shows the form. This would cause the form to fire it's Form1_Load method.
Could also be written like this:
VB Code:
Dim f as Form1
f = New Form1()
f.Show()
Ok.. Got it so far by changing the form name to the form I have.. (Don't know why but I was confusing my self with that) with this code:
VB Code:
Public Sub Main()
Dim Splash As New Splash
Call Splash.Show()
End Sub
Only problem is that the program ends right away and I only see the form for a brief second.. In VB6 I would do this:
What is the equivilent to that in .NET?
10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".
-
Jul 30th, 2004, 12:48 PM
#6
Frenzied Member
use a ShowDialog to show it modal. Also, I don't recommend you name your object the same as the class, that is confusing. At least call it oSplash
Dim oSplash as Splash
Sean
Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.
-
Jul 30th, 2004, 12:53 PM
#7
Thread Starter
Frenzied Member
10 different ways to skin a cat and amazingly enough each and every one has the same result, the cat gets skinned! The same can be applied to code, so be nice and accept each others "preferences".
-
Jul 30th, 2004, 01:52 PM
#8
Frenzied Member
VB6 actually created the reference for you behind the scenes, that's why you could do it in VB6. But that's really kind of sloppy and goes against things like encapsulation.
Sean
Some days when I think about the next 30 years or so of my life I am going to spend writing code, I happily contemplate stepping off a curb in front of a fast moving bus.
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
|