Question on checkedlistbox if statement
-
Hi all, for those of you who have been reading my countless posts on this same question, I think I have solved the problem by binding the database data to the checkedlistbox by using datasource and valuemember properties instead of the other way I was doing it because now the checkedlistbox items now bind by ID. Now in order to make the boxes auto tick depending on the particular employee page I am in(eg.this.EmployeeID), I think all I need help on is this 'if' statement. so far all the boxes are ticking with the following code. What is the if statement going to be?
techSkillsCheckListBox2.DataSource = dataSet1.TechnicalSkills; techSkillsCheckListBox2.DisplayMember = "ProgLanguagesDatabase"; techSkillsCheckListBox2.ValueMember = "TechnicalSkillsID"; int i; for (i = 0; i <= (techSkillsCheckListBox2.Items.Count - 1); i++) { if (FirstnameText.Text.Equals(this.EmployeeID)) { sql = "Select em.TechnicalSkillsID,t.TechnicalSkills,em.EmployeeID from EmpSkills em, TechnicalSkills t where t.TechnicalSkillsID = em.TechnicalSkillsID and em.EmployeeID = '" + FirstnameText.Text + "'"; techSkillsCheckListBox2.SetItemChecked(i, true)
Thank you :^) Sianny aka Sharny