|
-
Apr 2nd, 2002, 05:26 PM
#1
Thread Starter
New Member
New to VB.Net
Hello All.
I am just starting to get me feet wet with VB.NET. I have a startup module that sets some parameters and then when that is done I want to use the old VB 6 command of
FrmMain.Show
How is this done in Vb.NET? I have looked throughout the .Net Framework and the help to figure this out and I am at a hault.
I have looked at using:
Imports System
Imports System.Windows.Forms
Imports Microsoft.VisualBasic
what am I missing.
Thanks to all who can help me through this.
Art
-
Apr 2nd, 2002, 06:42 PM
#2
This is a major difference between vb6 and .NET. In .NET, forms are truly classes, as opposed to the pseudo-classes that they were in vb6. As such, when you create a frmMain with the frmDesigner, you have created a class called frmMain. Thusly, you must create a new instance of it, A la this:
VB Code:
Dim myForm as New frmMain
myForm.Show
Good luck!
Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.
-
Apr 2nd, 2002, 11:36 PM
#3
Originally posted by sunburnt
This is a major difference between vb6 and .NET. In .NET, forms are truly classes, as opposed to the pseudo-classes that they were in vb6. As such, when you create a frmMain with the frmDesigner, you have created a class called frmMain. Thusly, you must create a new instance of it
You're both right and wrong. You do have to declare an instance of a form in VB.NET because it is a real class, but in VB6, you also needed an instance to the form. The difference is that in VB6, there was already a variable automatically declared for you as an instance to the form. In VB.NET, you have to declare it yourself.
-
Apr 3rd, 2002, 09:21 AM
#4
Thread Starter
New Member
Thanks all. Once again the people of VB World rule again.
Thanks for your help. I did read something about this in the .NET framework, but I did not think it was that easy.
Thanks guys!!
Art
-
Apr 3rd, 2002, 09:30 AM
#5
Another way to show your first form in your Sub Main is to use
Application.Run(New formclass)
This is a required way for C# I believe but optional for VB .NET.
-
Apr 3rd, 2002, 03:46 PM
#6
I stand corrected
Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.
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
|