jhedonghae
Member
- Joined
- Mar 29, 2012
- Messages
- 17
- Programming Experience
- Beginner
please kindly help me!!!
what i wanted is when i select items in the combobox and it is already in the database it will prompt that it is already in the database..tnx
here is my code:
i think the problem is in this part "If ComboBox3.Text = "'" Then" i just don't know how to manipulate combobox when the event is validating...please help me
what i wanted is when i select items in the combobox and it is already in the database it will prompt that it is already in the database..tnx
here is my code:
01 | Private Sub ComboBox3_Validating(ByVal sender As Object, ByVal e AsSystem.ComponentModel.CancelEventArgs) Handles ComboBox3.Validating |
02 | If ComboBox3.Text = "'" Then |
03 | 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") |
04 | Dim ewaaa As String = "Select * from Schedulings where YearLevels = '" & ComboBox3.Text & "' And Sections = '" & ComboBox1.Text & "' " |
05 | com = New OleDbCommand(ewaaa, con) |
06 | con.Open() |
07 | rid = com.ExecuteReader |
08 | rid.Read() |
09 | If (rid.HasRows) Then |
10 | ComboBox3.Text = rid(2) |
11 | MsgBox("Section Already Exist", MsgBoxStyle.Critical, "Error") |
12 | ComboBox3.SelectedIndex = -1 |
13 | End If |
14 | End If |
15 | End Sub |
i think the problem is in this part "If ComboBox3.Text = "'" Then" i just don't know how to manipulate combobox when the event is validating...please help me