Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
Output as follows in Data Grid View in Windows application;
 
datepicker1 datepicker2
 
when i select datepicker1 in datepicker2 5 days added in the datapicker2. for that date only i give the fore and back ground color.
 

for example i mentioned the 1/7/12 and 1/8/12 date .
 
Date Session RK Mk CK Gk VK CMK CNN UNNi VB GS CM JN CA
 
1/7/12 1 REO Tasco AFF
1/7/12 2 REO Tasco AFF
1/7/12 3 REO Tasco AFF
1/7/12 4 REO Tasco AFF
 
1/8/12 1 REO Tasco AFF
1/8/12 2 REO Tasco AFF
1/8/12 3 REO Tasco AFF
1/8/12 4 REO Tasco AFF
 
from the output Data Grid View
 
fore color has light blue and back ground color as Sky Blue in 1/7/12 date
fore color has light brown and back ground color as purple in 1/8/12 date
Posted 13-Jan-13 5:50am
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You have already been given a suggestion in your previous posting of this question: how to give forecolor and background color for row[^]. If you have further information then please update the original question, rather than posting the same question again.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Shoot, I haven't tried that since 2005 and my information may be out of date. If I recall correctly, you have to do that on a cell-by-cell basis. Each Cell has a Style property.
 
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcell.style.aspx[^]
 
I'll also repeat that I dislike DataGridViews and I feel that they are the bane of usability, so please think before using one. For what I was writing back in 2005, I switched to a TreeView and everything was sweetness and light.
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

int thirdColumn = 2;
DataGridViewColumn col =
dataGridView.Columns[thirdColumn];
DataGridViewCell cell = new DataGridViewTextBoxCell();
 
cell.Style.BackColor = Color.Wheat;
col.CellTemplate = cell;
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Zoltán Zörgő 220
1 Sergey Alexandrovich Kryukov 205
2 Peter Leow 160
3 BillWoodruff 85
4 bling 80
0 Sergey Alexandrovich Kryukov 9,543
1 OriginalGriff 6,901
2 Peter Leow 4,737
3 Zoltán Zörgő 4,404
4 CHill60 2,932


Advertise | Privacy | Mobile
Web03 | 2.8.150129.1 | Last Updated 13 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100