Link to home
Start Free TrialLog in
Avatar of John (Yiannis) Toutountzoglou
John (Yiannis) ToutountzoglouFlag for Greece

asked on

Datagridview Check Box

In my DatagridView The last Column Is A checkbox Column.
Since I need only one of the checkboxes to be the main one,i want when i click on it all the others to return in a read only state untill i uncheck it

Please Guide me .
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Why not use a RadioButton instead?
Avatar of John (Yiannis) Toutountzoglou

ASKER

I never thought about it ..let me check it for a while and i msg you back..
thank you for your reply...
How do i represent a radio button in a datagridview ?...there no choise to change a checkbox column to a radio button column.
i think it a litle trick for me and not for my level...(it is not vb.net)
How about this..
i need only one check box to be checked
In a total of Rows.Count if >1 checkboxes are checked then message and reject last changes?
This Will Be accomplished by clicking the save button..
I have a code for that is this a good way?
You might be able to do that by attaching to the EditorControlShowing event handler, checking the state of a module-level state flag, and set the CheckBox.Enabled = False for all other CheckBoxes.
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
It is working ...i just add the
If CheckboxCount =0 then....
because always i need one to be checked..
thank you CodeCruiser
Thanks Also the LearnedOne for his answers
Code Cruiser ....just a correction....i change the "Value" with "FormattedValue"
to prevent the DBNULL TO BOOLEAN CONVERSION
That is a good step. You could also use the IsDBNull function to make sure its not null.
i 've done it both ....and both works properly....
see u in another question...thank you very much