DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 7 of 7

Thread: Form Show

  1. #1
    Join Date
    Jan 2007
    Posts
    3

    Form Show

    Hello, good day.

    I am developing a project in vb.net, I had wrote several in vb 6.0 and I remember that when you want to show a form, you just type:

    form1.show
    me.hide

    Now in vb.Net, I am having trouble with this, firts I donīt know what the error is, it only turns to underlined text, then, I delete the show part to see the properties menu that appears when you put a point, but it doesnīt show the Show() option.

    I also read that I can put my log in form as a dialog form, and put the form with the links to the other ones as the Main, but I dont know how to change my forms to do this.

    Can anyone help me with this?

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    In VB.NET, a form is a class; you must create an instance of the class (using the "New" keyword) before you may use it. Try this:

    Dim frm As New Form1
    frm.Show()
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Jan 2007
    Posts
    3

    Unhappy Form Error

    Hi, good day.

    I did that and when the event is fired the form sends an error:

    An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll

    I dont know what to do !!!!

  4. #4
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    A null reference exception usually means that you're trying to use an object that you've forgotten to initialize ("New"). Please post the code that's causing the error (no more than a dozen or so lines).
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  5. #5
    Join Date
    Jan 2007
    Posts
    3

    Dialog Form


    Thanks Phil, It was the "new" word that was missing.

    Now I read that I can "start" my solution in a Main form, and use the login form as a dialog, so I am on this now, but I have two text boxes with user and password and a validation boolean function, so, I have to send back to the main sub that the user has been validated, i have a couple of buttons also to "validate" the user.

    How do I do this, I mean which control has to be "true" and return the value to the Main sub?

    Thanks and best regards.

  6. #6
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    I would probably add a read-only property to the form to indicate whether the user successfully logged in:
    Code:
    Private Success As Boolean
    
    Public ReadOnly Property IsLoggedIn() As Boolean
        Get
            Return Success
        End Get
    End Property
    Set the Success variable equal to the result of your validation function. In your main form, check the value of LoginForm.IsLoggedIn().
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  7. #7
    Join Date
    Jun 2004
    Posts
    93
    In VB.Net 2005, you can show a form in 1 line
    My.Forms.Form1.Show

    From help...
    The My.Forms object provides an easy way to access an instance of each Windows Form declared in the application's project. You can also use properties of the My.Application object to access the application's splash screen and main form, and get a list of the application's open forms.

Similar Threads

  1. A form passing a parameter to another form
    By Bill Gaddam in forum VB Classic
    Replies: 10
    Last Post: 11-06-2007, 11:15 AM
  2. Replies: 0
    Last Post: 03-17-2005, 11:47 AM
  3. How do you show a .NET form?
    By Carl in forum .NET
    Replies: 5
    Last Post: 08-31-2002, 07:08 AM
  4. show icon of a borderless form in the toolbar
    By cyrille in forum VB Classic
    Replies: 0
    Last Post: 06-20-2001, 07:37 PM
  5. Don't Show a form MDI in taskbar
    By Nick in forum VB Classic
    Replies: 0
    Last Post: 11-16-2000, 10:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links