NoFace
NoFace

Reputation: 165

Window form refresh parameter passing

I currently testing with visual studio window form with Vb.net

I want to refresh my user login and pass the parameter to other form. but every time I success login in first user, when i relog to another user. it remain same data as first user

Private authUser As custMain = New custMain()
Dim id As String
Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
    If sql.HasConnection Then

        If isAuthenticated() = True Then

            sql.RunQuery("select UID from userAccount where username='" & txtUsername.Text & "' and password = '" & txtPassword.Text & "' and userType='cust'")
            For Each i As Object In sql.SQLDS.Tables(0).Rows
                id = i.item("UID")
            Next
            authUser.AuthName = id
            authUser.Invalidate()
            authUser.Refresh()
            authUser.Show()
            Me.Hide()
        End If
    End If
End Sub

Upvotes: 0

Views: 54

Answers (1)

Sarvesh Mishra
Sarvesh Mishra

Reputation: 2072

Use this code.

Private authUser As custMain 
Dim id As String
Private Sub btnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
    If sql.HasConnection Then

        If isAuthenticated() = True Then

            sql.RunQuery("select UID from userAccount where username='" & txtUsername.Text & "' and password = '" & txtPassword.Text & "' and userType='cust'")
            For Each i As Object In sql.SQLDS.Tables(0).Rows
                id = i.item("UID")
            Next
            authUser = New custMain()
            authUser.AuthName = id
            authUser.Show()
            Me.Hide()
        End If
    End If
End Sub

Upvotes: 1

Related Questions