I have an application that display some info from access 2016 database. - Form2 will display data from studentInfo table so Form2 will contain studentIDTextBox, studentNameComboBox, classComboBox, levelComboBox, studentDateDateTimePicker, nationalityComboBox, cityComboBox, provinceComboBox, blockTextBox...etc
levelComboBox:
- SelectedValue: studentInfoBindingSource - Level
- DataSource: studentLevelBindingSource
- DisplayMember: Level
- ValueMember: LevelID
classComboBox:
- SelectedValue: studentInfoBindingSource - Class
- DataSource: studentClassBindingSource
- DisplayMember: Class
- ValueMember: ClassID
Now my question is: Without effect the info has been display i want if i add a new item ( record ) to the database and when i choice a specific Level from levelComboBox it will change a list of classes within the selected Level in classComboBox and vice versa. How i can do that ?
I try to do that by using the code below but it is not good:
- private void provinceComboBox_SelectedIndexChanged(object sender, EventArgs e)
- {
- var cityQuary =
- from displayCity in student1516DataSet.city
- where displayCity.ProvinceName == provinceComboBox.Text
- select displayCity;
-
- cityComboBox.DataSource = cityQuary.AsDataView();
- }