473,379 Members | 1,337 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,379 software developers and data experts.

Datagrid checkbox states

Hi, I am very new to C# and am trying to figure out DataGrids. I have
a DataGrid whos data member (I think that is what it is called) has a
checkbox on it. The checkbox defaults to a check that is greyed. We
want 2 states, not 3, on or off. Is this possible to do and if so,
how?

Thanks!

Oct 4 '07 #1
3 1721
Soulless,

You would want to get the DataGridViewCheckBoxColumn for that column and
set the ThreeState property to false.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Soulless" <dg*******@gmail.comwrote in message
news:11*********************@y42g2000hsy.googlegro ups.com...
Hi, I am very new to C# and am trying to figure out DataGrids. I have
a DataGrid whos data member (I think that is what it is called) has a
checkbox on it. The checkbox defaults to a check that is greyed. We
want 2 states, not 3, on or off. Is this possible to do and if so,
how?

Thanks!

Oct 4 '07 #2
On Oct 4, 9:13 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Soulless,

You would want to get the DataGridViewCheckBoxColumn for that column and
set the ThreeState property to false.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"Soulless" <dgmsal...@gmail.comwrote in message

news:11*********************@y42g2000hsy.googlegro ups.com...
Hi, I am very new to C# and am trying to figure out DataGrids. I have
a DataGrid whos data member (I think that is what it is called) has a
checkbox on it. The checkbox defaults to a check that is greyed. We
want 2 states, not 3, on or off. Is this possible to do and if so,
how?
Thanks!- Hide quoted text -

- Show quoted text -
I apologize for my ignorance, but where should I set this? I am
trying to find the proper method/syntax to do this.
I type this.<name of DataGrid>. but am not sure what to pick from
the list. There is not a DataGridViewCheckBoxColumn.... do I need to
specify something more?

Sorry for my ignorance, I am trying to learn as quickly as possible.
Thanks very much for your help :)

Oct 4 '07 #3
You can access the Columns collection, which is indexed by position, or
the name of the column. From there, you have to cast the return value to a
DataGridViewCheckBoxColumn, and then set the property:

// The column.
DataGridViewColumn column = this.gridView1.Columns["booleanColumn"];

// Cast to a DataGridViewCheckBoxColumn.
DataGridViewCheckBoxColumn checkboxColumn = (DataGridViewCheckBoxColumn)
column;

// Set the ThreeState property to false:
checkboxColumn.ThreeState = false;
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Soulless" <dg*******@gmail.comwrote in message
news:11**********************@22g2000hsm.googlegro ups.com...
On Oct 4, 9:13 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
>Soulless,

You would want to get the DataGridViewCheckBoxColumn for that column
and
set the ThreeState property to false.

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"Soulless" <dgmsal...@gmail.comwrote in message

news:11*********************@y42g2000hsy.googlegr oups.com...
Hi, I am very new to C# and am trying to figure out DataGrids. I have
a DataGrid whos data member (I think that is what it is called) has a
checkbox on it. The checkbox defaults to a check that is greyed. We
want 2 states, not 3, on or off. Is this possible to do and if so,
how?
Thanks!- Hide quoted text -

- Show quoted text -

I apologize for my ignorance, but where should I set this? I am
trying to find the proper method/syntax to do this.
I type this.<name of DataGrid>. but am not sure what to pick from
the list. There is not a DataGridViewCheckBoxColumn.... do I need to
specify something more?

Sorry for my ignorance, I am trying to learn as quickly as possible.
Thanks very much for your help :)

Oct 4 '07 #4

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

Similar topics

2
by: Evan Brown | last post by:
Hi I have a Datagrid with a boolean column in it. I currently have it set as a textboxColumn and not a checkcolumn. what I want to do is have it say yes/no not true/false. Any suggestions? ...
0
by: ZS | last post by:
Hi, I have a boolean column in my datagrid. During runtime when I check the checkbox there are actually Three states for the checkbox. So I have to actually double click to change from true to...
0
by: Amar | last post by:
I have created a Template Column and Added to a Datagrid, which contains a checkBox. The column is not Binded to any column of the Dataset, but is an extra one so i can retrieve on Save Button...
2
by: Raed Sawalha | last post by:
Dear: I have DataGrid , which its task to (Edit, update, and delete) contents of XML File. the structure of XML like this <Info> <Name></Name> <Age></Age>
3
by: Steven | last post by:
How can I disable the ThreeState of a checkbox in a datagrid datacolumn (dataset)? Because of the ThreeState the checkboxes in my datagrid can be in the states 'Checked', 'Unchecked', and...
17
by: Mike Fellows | last post by:
im trying (unsucessfully) to add a checkbox column to my datagrid i basically have a datagrid that im populating from a dataset Me.DataGrid1.DataSource = ds.Tables(0) the datagrid then has 5...
2
by: RbanBph | last post by:
Hello, I have used datagrid in my web application. I want to set datasource to this datagrid. I want to display check boxes in one of its column. How can i add checkboxes in my datagrid using...
3
by: Fao, Sean | last post by:
I have a DataGrid that I'm adding CheckBox controls to at runtime (in the code behind) and I'm not sure if I'm doing it correctly. First of all, I noticed that the MyDataGrid.Columns.Add() method...
4
by: mamun | last post by:
Hi All, I have the following situation and am looking for answer in C#. I have a datagrid and putting checkbox next to each record. In the header I have a Delete button. I want users to...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.