473,439 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,439 software developers and data experts.

Datagrid - Windows - DataGridBoolColumn - How can I disable all the check boxes in the column

I tried boolCol.ReadOnly = true and a bunch of other things but can't get
the check boxes for the datagrid's column for all rows to be disabled? Can
someone tell me how to do this?

MyGrid.ReadOnly = true;

MyGrid.Click += new EventHandler(MyGrid_Click);

MyGrid.CaptionVisible = false;

tableStyle = new DataGridTableStyle();

tableStyle.MappingName = "MyItemsData";

tableStyle.AllowSorting = false;

tableStyle.RowHeadersVisible = false;

//MyCheckBox Check

boolCol = new DataGridBoolColumn();

boolCol.MappingName = "MyCheckBox";

boolCol.HeaderText = "MyCheckBox";

boolCol.AllowNull = true;

boolCol.NullValue = string.Empty;

boolCol.FalseValue = false;

boolCol.TrueValue = true;

boolCol.Width = boolColWidth;

tableStyle.GridColumnStyles.Add(boolCol);

boolCol = null;
Nov 17 '05 #1
3 1356
Richard,

From your code I get the idea that you are using a windowforms datagrid,
but when I see the newsgroups you are posting to, than you bring me in
doubt.

Therefore a short answer. For a windowsform datagrid is the bool column only
representing the status in the underlying datasource. Therefore you need to
set the underlying datasource to the values you want.

I hope this helps,

Cor
Nov 17 '05 #2
Yes, it is bound to a DataTable. I had a feeling that it would have to be a
manual process of going through the datatable and setting the booleans to
whatever. I did not realize I was posting to the aspnet group.
"Cor Ligthert" <no************@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Richard,

From your code I get the idea that you are using a windowforms datagrid,
but when I see the newsgroups you are posting to, than you bring me in
doubt.

Therefore a short answer. For a windowsform datagrid is the bool column only representing the status in the underlying datasource. Therefore you need to set the underlying datasource to the values you want.

I hope this helps,

Cor

Nov 17 '05 #3
Richard,

Maybe does this sample that I just made do what you want.

\\\\
Dim dt As New DataTable
dt.Columns.Add("MyColumn", GetType(System.Boolean))
dt.LoadDataRow(New Object() {True}, True)
dt.LoadDataRow(New Object() {True}, True)
dt.LoadDataRow(New Object() {True}, True)
dt.LoadDataRow(New Object() {True}, True)
Dim ts As New DataGridTableStyle
ts.MappingName = dt.TableName
Dim column As New DataGridBoolColumn
ts.GridColumnStyles.Add(column)
DataGrid1.TableStyles.Add(ts)
column.MappingName = dt.Columns(0).ColumnName
column.ReadOnly = True
DataGrid1.DataSource = dt
///
I hope this helps,

Cor
Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Morné | last post by:
Hi how do I validate a text value in a datagrid e.g. the user is only allowed to type in a Y or a N. I specifically have a problem with using the PropertyDescriptorCollection. I get the...
5
by: Jeff Cook | last post by:
Hi I have a DataGrid that I am using to display a .xml file (that has a schema in a .xsd), like this:- ds.ReadXmlSchema(sDataPath + "Data.xsd"); ds.ReadXml(sDataPath + "Data.xml",...
1
by: Jim Ptak via .NET 247 | last post by:
I am desperate for help. I am at a loss. I have a dataset with 4columns in it. The first column is an actual column from adatabase table. The last three columns are hard codded values of0. I am using...
2
by: Raj | last post by:
Hi, When we are sorting the DataGrid Boolean column the grid is becoming redcross. I have my own PPMIPDataGridBoolColumn class inherited from System.Windows.Forms.DataGridBoolColumn. In this...
2
by: sianan | last post by:
I have a DataGrid which displays data from a table in a MS SQL 2000 database. My problem is that I have a bit column in the database whose values I want to display as checkboxes in the DataGrid. I...
4
by: Pacific Design Studios | last post by:
I have a DataGrid on Form1 that displays a small amount of information about employees. On Form2 I want to have all the data displaying in text boxes about the employee selected in the datagrid on...
2
by: Agnes | last post by:
In myDatagrid, there is 3 columns, account code, debit,credit. If the user input some particular a account code in column1 , i need to based on the contect of column1, to disable...
3
by: Richard | last post by:
I tried boolCol.ReadOnly = true and a bunch of other things but can't get the check boxes for the datagrid's column for all rows to be disabled? Can someone tell me how to do this? ...
3
by: GatorBait | last post by:
Hi all, I'm using a datagrid for the first time and I am running into some problems that I hope someone can help me with. I have a datagrid with 18 rows and 5 columns....column 1 is just text...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.