1.11M Members

validating combobox

 
0
 

Untitled58 it works tnx but when i click the message box the attach image that shows the problem occurs

Attachments
Question Answered as of 2 Years Ago by poojavb, Mitja Bonca and venus1
 
0
 

U can use Debug.Print("text: "+ text) to check the value...if u dont know how to use debugger

it will show the value of the word declared as a variable but it should be string else convert it to String...

Try this below code...

  Private Sub ComboBox3_SelectedIndexChanged(sender As System.Object, e As System.EventArgs)

con = New OleDbConnection("Provider= Microsoft.ACE.oledb.12.0; Data Source=C:\Users\edenzam\Desktop\CBFMNHS Enrollment System\CBFMNHS Enrollment System\bin\Debug\Enrollment System.accdb")

Dim ewaaa As String = "SELECT * FROM Schedulings WHERE YearLevels = '" & ComboBox3.SelectedItem.ToString() & "' AND Sections = '" & ComboBox1.SelectedItem.ToString() & "'"
com = New OleDbCommand(ewaaa, con)
con.Open()
rid = com.ExecuteReader()
    If rid.Read = True Then
       MsgBox("Section Already Exist", MsgBoxStyle.Critical, "Error");
       else
       MsgBox("Section does not Exist", MsgBoxStyle.Critical, "Error");
    End If
End Sub
 
0
 

instead of & use + sign.....if still it does not work then try to convert SelectedItem.ToString to Text....hope it works for u...

 
0
 

tnx

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article