473,503 Members | 1,654 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows Form DataGrid Contol, Cell text color problem

I have a DataGrid with 3 Columns.

I want to change Cell text color of only first Column. How I do that?

Thanks!

Mar 24 '07 #1
2 3906
this.dataGridView1.Columns.Add("first", "first");
this.dataGridView1.Columns.Add("second", "second");
this.dataGridView1.Columns.Add("third", "third");

this.dataGridView1.Columns[0].DefaultCellStyle.ForeColor = Color.Red;
this.dataGridView1.Rows.Add(new Object[] { "first item", "second item",
"third item" });

If you've got your columns being databound, you won't manually create them
as I did, but you can still get at the first column and set the forecolor.
--
~~~~~~~~~~~
Ben Rush
http://www.ben-rush.net/blog
<sa*******@yahoo.comwrote in message
news:11**********************@n76g2000hsh.googlegr oups.com...
>I have a DataGrid with 3 Columns.

I want to change Cell text color of only first Column. How I do that?

Thanks!

Mar 24 '07 #2
If you need to work with a Windows Forms DataGrid, then it is more
work to color a column. Here is a MSDN article and FAQ entry that
discusses this.

http://msdn2.microsoft.com/en-us/library/ms996485.aspx

http://www.syncfusion.com/faq/window...earch/745.aspx

==================
Clay Burch
Syncfusion, Inc.
Mar 25 '07 #3

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

Similar topics

14
2033
by: Jack Kaufmann | last post by:
I am trying to verify a datagrid in which there must be an entry in both columns of any new row, and those values must be greater than the corresponding values in the previous row. It is pretty...
2
1532
by: Paul Daly (MCP) | last post by:
How do you access the value of a cell in a Windows form datagrid? I know this is how you would do it using an ASP.NET datagrid: DataGrid1.Items.Cells.Text However, "Items" is not available in...
21
3040
by: DraguVaso | last post by:
Hi, I have an inherited DataGrid, that does lots of extra stuff. For exemple drawing a backgroundimage in every cell. The problem is that it's taking too much time (using gdi+), so I want to do...
3
3016
by: PeterZ | last post by:
G'day, After doing much searching and pinching bits of ideas from here there and everywhere I came up with a fairly 'clean' solution of including a comboBox into a dataGrid column. You can...
2
1454
by: Wayne | last post by:
I have a datagrid on my windows form, it needs to be read only and when a user selects a row, I want the whole row to be selected. How would I go about doing this? -- Thanks Wayne Sepega...
2
1575
by: martin | last post by:
Hi, I am iterating through the dataitems in a datagrid and producing and xml document, If a particular cell in the datagrid has a textbox control or a datagrid control in it then I have no...
2
1599
by: itgMan | last post by:
hello friends, i have a question about datagrid, i have binded a datagrid with a datatable from values that came from a comma seperated values (.CSV) file i have created textboxes in all...
13
2631
by: Lyners | last post by:
I have a web page writen in ASP.NET that contains some javascript so that when a user presses a button, or edits a certain field in a datagrid, another cell in the datagrid is filled with a value....
2
2073
by: benfly08 | last post by:
Hi, everyone. I got a weird problem for my C# program. In my program, I use a DataGrid to display data. I bind the DataGrid to a DataTable. I made all the cells in DataGrid ReadOnly as True. So...
0
7198
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
7072
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6979
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
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5570
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
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
373
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.