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 4: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
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 462
1 sanket saxena 355
2 OriginalGriff 235
3 Abhinav S 233
4 CPallini 205
0 Sergey Alexandrovich Kryukov 8,784
1 OriginalGriff 5,025
2 Peter Leow 3,839
3 Maciej Los 3,535
4 Er. Puneet Goel 3,107


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