-2

I am slowing learning my way round c# and SQL. I have started a project that will have a list of checkboxes. I want these checkboxes to be ticked if there is any data present within the table. I am not interested in what data, only if there is data in the table.

I have created a win form project that can connect to the database and show the data in a grid view.

Any help would be fantastic!

Chris Birch
  • 41
  • 2
  • 7
  • Please update your question to include some minimal code example of what you have tried and doesn't work. This way we can't really help without knowing how you check if there is no data or what the structure of the data you are trying to check is. – vl4d1m1r4 Sep 26 '18 at 20:29

1 Answers1

1

Just set the Checked properties on the checkboxes.

checkBox1.Checked = dataGridView1.Rows.Count > 0;

It would help a huge amount and you will be more likely to get a better answer if you posted some things you have tried already or some examples of your code so far.

Emcrank
  • 310
  • 2
  • 12