0

Hi All.

I have developed an application for booking meeting rooms. A user has to log in before he / she can use the system.

I want the user name of that user to be shown in the form.

I thaught this was easy.

Please see my code below for the log in form

Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click

        Dim cmd As New SqlCommand("Select Name,Password from Users Where Name = '" & cmbBoxUsers.Text & "' and password = '" & txtBoxPassword.Text & "'", conn)
        Dim dr As SqlDataReader
        dr = cmd.ExecuteReader

        If dr.Read Then
            MsgBox("Login Accepted")
            MRMMain.Show()
            Me.Dispose()
        Else
            MsgBox("Login Failed, Please Try Again")
            cmbBoxUsers.Focus()
            txtBoxPassword.Focus()
        End If

        MRMMain.Text = cmbBoxUsers
    End Sub

    
End Class

I am getting this error on the line "MRMMain.Text = cmbBoxUsers"

Value of type System Windows Forms ComboBox cannot be converted to string

can anyone help me out with this.

Thanks very much

John

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by discovery-power
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.