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 3

int thirdColumn = 2;
DataGridViewColumn col =
dataGridView.Columns[thirdColumn];
DataGridViewCell cell = new DataGridViewTextBoxCell();
 
cell.Style.BackColor = Color.Wheat;
col.CellTemplate = cell;
  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

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 735
1 OriginalGriff 385
2 CPallini 240
3 PIEBALDconsult 150
4 Magic Wonder 131
0 OriginalGriff 5,835
1 Sergey Alexandrovich Kryukov 5,198
2 CPallini 4,740
3 George Jonsson 3,167
4 Gihan Liyanage 2,470


Advertise | Privacy | Mobile
Web03 | 2.8.140916.1 | Last Updated 13 Jan 2013
Copyright © CodeProject, 1999-2014
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