I have small problem, i dont know how realise more arguments filter.
I have 3 checkbox, Name, Category and Date(start,end)
Here is my code, individyaly for 1 check it work fine
if (checkBox1.Checked == true)
{
views.RowFilter = "[Produkta nosaukums] like '%" + textBox3.Text.ToString() + "%'";
}
if (checkBox2.Checked == true)
{
views.RowFilter = "[Kateg.] like '%" + comboBox4.Text.ToString() + "%'";
}
if (checkBox3.Checked == true)
{
views.RowFilter = "[Derīguma termiņš] >= #" + dateTimePicker3.Value.ToString("yyyy/MM/dd") + "# and [Derīguma termiņš] <= #" + dateTimePicker4.Value.ToString("yyyy/MM/dd") + "#";
}
Problem is when i want more arguments search, like name and category.
I tryed here is my code, but only work for category name ignored :/
if (checkBox1.Checked == false & checkBox2.Checked == false & checkBox3.Checked == false)
{
dataGridView1.Columns.Remove(editButton);
dataGridView1.Columns.Remove(deleteButton);
LOADALL();
}
if (checkBox1.Checked == true & checkBox2.Checked == true)
{
MessageBox.Show(comboBox4.Text.ToString());
MessageBox.Show(textBox3.Text.ToString());
views.RowFilter = "[Kateg.] like '%" + comboBox4.Text.ToString() + "%' and [Produkta nosaukums] like '%" + textBox3.Text.ToString() + "%'";
}
What i want is, filter add another checkbox too.
- Check1, check2, check3
- true true true dont realized
- true false true dont realized
- false true true dont realized
- true true false dont work tryed
- true false false work
- false true false work
- false false true work
- false false false work
Problem i dont know how combine :) tryed but dont worked :/