Hide or Close doesnot work

  • Thread starter Thread starter Hari
  • Start date Start date
H

Hari

VB.NETers,

I have a problem with my form not getting closed and it gives me error to
either continue or quit.

I am using the following code

frmmain.show() ---- this works
frmLogin.Hide() -- this is where it bombs out.

This is a project that I successfully upgraded to .NET from VB6

Am I missing something??



Thanks for any help.

Hari
 
An unhandled exception has occured in your application. If you click
Continue, the application will ignore this error and attempt to continue. If
you click Quit, the application wil be shut down immediately.

Object reference not set to an instance of an object.

I do have an instance of the frmLogin form and still it doesnot work.
 
first works before u might have created frmmain's object..
and second will not as u did not have creatd object of frmlogin...
try dim frmLogin as new frmLogin
frmLogin.hide
 
I do have it...but it didnot work.

I am sure the first worked because (frmMain.Show()), the frmMain was not
created yet.
Can't I have a constructor inside a class?? Is that a problem or what??

Sure, I used dim frmLogin as new frmLogin and still it didnot work..

Any other clues??

Appreciate you help.

thanks,
hari
 
An unhandled exception has occured in your application. If you click
Continue, the application will ignore this error and attempt to continue. If
you click Quit, the application wil be shut down immediately.

Object reference not set to an instance of an object.

I do have an instance of the frmLogin form and still it doesnot work.


Can you show us where you declared frmLogin?
 
This sub is inside the public class frmLogin inherits.............
Private Sub cmdGo_Click(ByVal eventSender As System.Object, ByVal eventArgs
As System.EventArgs) Handles cmdGo.Click

Dim SQL As Object

Dim frmMain1 As New frmMain()

Dim frmlogin1 As New frmLogin()

openconn()

SQL = "Select * from Emp_Info "

If Not rs.EOF Then

Password = txtPassword.Text

BadgeNo = CShort(txtBadge.Text)

frmMain1.Show()

'frmlogin1.Visible = False

'frmlogin1.ShowInTaskbar = False

frmlogin1.close()

Else

End If

End Sub
 
Back
Top