Hi folks
Im a newbie.
I have a combobox cboTeachersName that is bound to deptTeachers table.
At runtime, it contains teachers of given subject (Course).
I then select a teacher and save in a field in another table called Summaries.
PROBLEM IS
When I load the form and load the saved record, the selected teacher is not the selected item in combobox.
combobox is empty.
I want that when I load the form and the saved record then combo should display saved teacher as the selecteditem
How can I make this happen?
Here is my code to fill combo (called in form load event)
Sub FillComboTeachersName()
SQLDeptTeacher = "SELECT Teachers.teachersname FROM DeptTeachers INNER JOIN Teachers ON
Teachers.TeachersID=DeptTeachers.TeachersID INNER JOIN Depts ON Depts.DeptID=DeptTeachers.DeptID WHERE
Depts.DeptName='" & Me.txtSubjectName.Text & "' "
CmdDeptTeacher = New SqlCommand(SQLDeptTeacher, Conn)
DRDeptTeacher = CmdDeptTeacher.ExecuteReader
While (DRDeptTeacher.Read())
With Me.cboTeachersName
.Items.Add(DRDeptTeacher("teachersname"))
End With
End While
CmdDeptTeacher.Dispose()
DRDeptTeacher.Close()
End Sub
Your help will be appreciated