Results 1 to 3 of 3

Thread: forms and vb.net

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Posts
    13

    forms and vb.net

    trying to close one form and display another froma command button but i keep getting this error.

    An unhandled exception of type 'System.NullReferenceException' occurred in WindowsApplication1.exe

    Additional information: Object reference not set to an instance of an object.

    i've tried .show .showdialog and nothing seems to work. first program i've tried to do in .net so there could be something that's changed from 6.0 that i'm missing

    if it helps at here here's the code where i get the error trying to show the form

    Private Sub CmdEnter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdEnter.Click
    Pass = TxtPassword.Text


    If Pass <> passcheck Then
    MsgBox("Wrong password enterd", MsgBoxStyle.OKOnly)
    Else
    Me.Hide()
    form2.Show()

    End If
    End Sub

  2. #2
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    Short answer:
    Dim frm as New Form2
    frm.Show()


    Best answer, and a requirement to understanding the why and hows of multiple forms in .Net:
    http://msdn.microsoft.com/library/de...adingtonet.asp

    It is required reading for upgrading from VB6 to VB.Net

  3. #3

    Thread Starter
    New Member
    Join Date
    Jul 2003
    Posts
    13
    thank you very much

    never found that when searching the web

    and msdn i've found often times isn't much of a help

    been stuck on this for couple days now thanks for the info and the link to read up

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