TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Fahad Aldaferi
NA
12
4.9k
C# Database: combobox value base on another combobox. How?
Aug 1 2016 7:07 AM
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
Answers (
7
)
Convert PDF to flipbook
Sort in sql server