Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
7
Reply
C# Database: combobox value base on another combobox. How?
Fahad Aldaferi
Aug 1 2016 7:07 AM
436
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();
}
Reply
Upload Source Code
Select only zip and rar file.
Post
Reset
Answers (
7
)
Convert PDF to flipbook
Sort in sql server