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