HighTechTalks DotNet Forums  

how to change a cell back or fore color in datagridview

Dotnet Data Tools microsoft.public.dotnet.datatools


Discuss how to change a cell back or fore color in datagridview in the Dotnet Data Tools forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
barbara_dave@yahoo.com
 
Posts: n/a

Default how to change a cell back or fore color in datagridview - 01-14-2009 , 05:11 PM






Hi All,

I want to change the cell backcolor or forecolor, my code is the
following:

DataGridView1.datasource = dt 'dt is a data table
DataGridView1.Item(1,1).Style.ForeColor = Color.Red
DataGridView1.Item(1,1).Style.BackColor= Color.Blue

when I run the program, the specified cells do not change their color.
Why?

Thanks for the help!

Reply With Quote
  #2  
Old   
Ivan
 
Posts: n/a

Default Re: how to change a cell back or fore color in datagridview - 02-12-2009 , 09:02 AM






Try this

DataGridView1.Rows(1).Cells(2).Style.BackColor = Color.Blue





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.