Hi Ramtin,
To achieve the final requirement, you can use the values of textbox1, textbox2 and combobox as conditions to fill the checkedlistbox with corresponding data.
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
//clear the checkedboxlist everytime that the combobox itme is changed
checkedListBox1.Items.Clear();
//loop through the "cranemaintable" table and if the item that selected in the combobox is
//equal to the "crane type" column then populate that item into the checkedlistbox
foreach (DataRow item in dt.Rows)
{
if (Convert.ToString(item["crane type"]) == Convert.ToString(comboBox1.SelectedItem))
{
if (Convert.ToInt32(item["Crane Capacity Rating (tons)"]) > int.Parse(textBox1.Text) && Convert.ToInt32(item["Crane Capacity Rating (tons)"]) < int.Parse(textBox2.Text))
{
checkedListBox1.Items.Add(Convert.ToString(item["crane model number"]));
}
}
}
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
comboBox1.DataSource = crane_type;
}
Best Regards,
Daniel Zhang