Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Making checkbox default value not selected
 

Making checkbox default value not selected

Hi,
i have added a check box column to the data table
as shown below

childTable.Columns.Add(

"Select", GetType(Boolean))
the check box is displayed with value as selected

how to make the checkbox default selection to not selected????

syago  Tuesday, August 11, 2009 5:22 AM
Try this way:

DataColumn column = new DataColumn();
column.DataType = System.Type.GetType("System.Boolean");
column.AllowDBNull = false;
column.Caption = "Select";
column.ColumnName = "Select";
column.DefaultValue = false;

childTable.Columns.Add(column);

Please mark the post as answer if it is helpfull to you because it boosts the members to answer more and more.
_SuDhiR_  Tuesday, August 11, 2009 5:49 AM
It should not.
How you bind to DatagridView, do you change TrueValue or FalseValue of DataGridViewCheckBoxColumn ?
NareshG  Tuesday, August 11, 2009 5:40 AM
Try this way:

DataColumn column = new DataColumn();
column.DataType = System.Type.GetType("System.Boolean");
column.AllowDBNull = false;
column.Caption = "Select";
column.ColumnName = "Select";
column.DefaultValue = false;

childTable.Columns.Add(column);

Please mark the post as answer if it is helpfull to you because it boosts the members to answer more and more.
_SuDhiR_  Tuesday, August 11, 2009 5:49 AM

You can use google to search for other answers

Custom Search

More Threads

• datagridviewcomboboxcell selectedindexchanged problem
• Tableadapter update problem with transaction
• Problem with Virtual ListView, Help needed.
• Enforce Constraints question
• To:ahmedilyas and the rest
• Bug??? Guid Support
• how to keep the leftside columns visible when the scroll bar moves in a datagrid?
• can we bind the SqlCommand directly to the Dataview
• Regd. list view
• Datagrid clear