Hi,
I have a datagridview table on my windows forms and a checklistbox.
When a user clicks items from the checklist box I want it to display only them items in the datagridview.
I currently have it so that it goes through the checkboxlist to check which ones are ticked (it also creates a textbox and puts the value of the checked item in an individual textbox)
But it only displays one of the items I check.
Here is my current code:
Any help is appreciated.
Thank you.
I have a datagridview table on my windows forms and a checklistbox.
When a user clicks items from the checklist box I want it to display only them items in the datagridview.
I currently have it so that it goes through the checkboxlist to check which ones are ticked (it also creates a textbox and puts the value of the checked item in an individual textbox)
But it only displays one of the items I check.
Here is my current code:
C#:
private void lstDropDown_SelectedIndexChanged(object sender, EventArgs e)
{
for (int i = 0; i < lstDropDown.CheckedItems.Count; i++)
{
//Create textbox
TextBox textBox = new TextBox();
//Position textbox on screen
textBox.Left = 120;
textBox.Top = (i + 1) * 20;
//Add controls to form
this.Controls.Add(textBox);
textBox.Text = (lstDropDown.CheckedItems[i].ToString());
dtRecord.DefaultView.RowFilter = string.Format("Section = '{0}'" , textBox.Text);
}
Any help is appreciated.
Thank you.