flavour404
flavour404

Reputation: 6312

Datagridview checkbox column only allowing me to select one check box

Ok, the first column in my datagridview is a checkbox. I have 'multiselect' set to true and that does indeed work. However, a user is only allowed to check one checkbox at a time, if they select another the original unchecks itself, how do I stop that? I need a user to be able to select, say 3 out of 5 rows using the checkbox so that they can carry out a group action.

Thanks, R.

Upvotes: 0

Views: 5705

Answers (3)

Fahad Malik
Fahad Malik

Reputation: 1

Accidentally i write

DataGridViewCheckBoxColumn chk = new DataGridViewCheckBoxColumn();
DataGridView.Columns.Add(chk);
chk.HeaderText = Check Data;
chk.Name="chk";

-----> "chk.FalseValue = true;" this was causing me the error

after removing it problem resolved

Upvotes: 0

trhess
trhess

Reputation: 61

You have to set the VirtualMode setting to false on the datagridview to check more than one.

Upvotes: 6

Hans Olsson
Hans Olsson

Reputation: 55009

A DataGridView will by default allow multiple checkboxes to be checked at the same time. Just to make sure I just created a DGV and added one checkbox column and 2 textbox columns to it and I could check multiple rows.

I think you might accidently have done something that makes this happen? Maybe try removing the DGV and creating a new one (or if that's a lot of work, create a new one next to it and then compare the settings for both of them and do a search for the old one to make sure it's not changed dynamically somewhere).

Upvotes: 0

Related Questions