Go Premium for a chance to win a PS4. Enter to Win

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 146
  • Last Modified:

winform combo relationship

Hi I have two tables 1) student and 2) student_type

I have 2 two combo's (thats the requirement which exists as of now)

When student_type is selected all the students have to be shown in another combo.
Incase the student_type is not selected and student is selected the student_type has to be highlighted.

I have a single query written for this (I cant use datarelations as all the existing use joins)

Select student_id,Student_type_id,Student_name,student_type_desc from student a,student_type b
where b.student_type_id = a.student_type_Id

Can the code be shown for the requirement

currently i bind the following way

comboStudent.Datasource = ds.tables[0];
combostudent.displaymember = student_name;
combostudent.valuemember = student_id
combostudent.selectedIndex = -1
combostudent.sleectedndexchnaged = += new System.EventHandler(this.combostudent_SelectedIndexChanged);

cboType.Datasource = ds.tables[0];
cboType.displaymember =  student_type_desc;
cboType.valuemember =student_type_id
cboType.selectedIndex = -1
cboTypet.sleectedndexchnaged = += new System.EventHandler(this.cboType_selectedindexchanged);
1 Solution

Featured Post

Veeam and MySQL: How to Perform Backup & Recovery

MySQL and the MariaDB variant are among the most used databases in Linux environments, and many critical applications support their data on them. Watch this recorded webinar to find out how Veeam Backup & Replication allows you to get consistent backups of MySQL databases.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now