Results 1 to 6 of 6

Thread: New to VB.Net

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Location
    Shelton, CT
    Posts
    9

    Exclamation 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
    Art DeGaetano II
    Software Developer
    [email protected]

  2. #2
    PowerPoster sunburnt's Avatar
    Join Date
    Feb 2001
    Location
    Boulder, Colorado
    Posts
    1,403
    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:
    1. Dim myForm as New frmMain
    2. 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.

  3. #3
    Tygur
    Guest
    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.

  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 2000
    Location
    Shelton, CT
    Posts
    9

    Thumbs up

    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

  5. #5
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    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.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  6. #6
    PowerPoster sunburnt's Avatar
    Join Date
    Feb 2001
    Location
    Boulder, Colorado
    Posts
    1,403
    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
  •  



Click Here to Expand Forum to Full Width