newbie question. i have a class where i will get the value of username and password of my login form and pass it to admin form
Public Property getUsername() As String
Get
Return Login.username.Text
End Get
Set(value As String)
uname = value
End Set
End Property
Public Property getPassword() As String
Get
Return Login.password.Text
End Get
Set(value As String)
pword = value
End Set
End Property
and a function getName()
Public Function getName()
con.Open()
Dim sd As New SqlDataAdapter("select * from AdminAcc where Username = '" & getUsername() & "'", con)
Dim dt As New DataTable
sd.Fill(dt)
con.Close()
getName = dt.Rows(0)(1).ToString()
End Function
i want to display the name of that user in my form so i tried this one
Private Sub AdminM_Load(sender As Object, e As EventArgs) Handles MyBase.Load
admingreeting.Text = "Hi, " + queryclass.getName()
End Sub
its actually working but when i tried to sign out the application stops and a break mode window appears
Private Sub btnsignout_Click(sender As Object, e As EventArgs) Handles btnsignout.Click
If MsgBox("Are you sure you want to sign out?", vbQuestion + vbYesNo) = vbYes Then
Login.Show()
Me.Close()
End If
End Sub
i tried using the me.hide(), it worked but when i tried to login another account, the value in the previous getName() didnt change.
Help :( thanks in advance!