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
        Return Login.username.Text
    End Get
    Set(value As String)
        uname = value
    End Set
End Property
Public Property getPassword() As String
        Return Login.password.Text
    End Get
    Set(value As String)
        pword = value
    End Set
End Property

and a function getName()

  Public Function getName()
    Dim sd As New SqlDataAdapter("select * from AdminAcc where Username = '" & getUsername() & "'", con)
    Dim dt As New DataTable
    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
    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!

Re: VB.Net Me.Close not working and a Break Mode window appears 80 80

While you can work out how to share more about this break screen/message I want to write about a basic design flaw.

Never store those passwords. This is exactly why so many sites get into trouble so quickly. You never store the password, but it's salted encrypted value. This is well discussed and you never want to teach storing of the password or accept it in an assignment or solution.

More at

About the value that persists. In your or method that fires when the form gets shown, you add code to change those variables to blank or set the input box contents to blank. This is not automatic. You code this.

Re: VB.Net Me.Close not working and a Break Mode window appears 80 80

oh i forgot to mention, this is actually for our assignment in school and not for work so storing password doesn't matter. But thanks, i'll keep that in mind.
i dont know if the button is the problem or what. i made a new button and place it beside that button (same panel) and it didnt work. is it because of the panel or button? i tried to put it in a different button(same form, different panel) and it worked.

Re: VB.Net Me.Close not working and a Break Mode window appears 80 80

It may be time for the course to be updated. At least you now know why companies leak personal information. Folk were taught badly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.