Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Datagridview cell formatting
Message
 
 
À
11/06/2010 18:51:16
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 3.0
Divers
Thread ID:
01468613
Message ID:
01468625
Vues:
35
I see, you want to check ColumnHasComment value but change ColumnSono color depending on value in the HasComment column. If so, it may be a bit more complex - I'll answer on Saturday's night if you didn't get answer earlier.

>>>Do the exact same code but check at the top for "ColumnSono" instead of "ColumnHasComment"
>
>What would the code look like?
>
>When dealing the event for ColumnSono e.Value contains the Sono , not the hascomment value.
>
>I want to change the backcolor of ColumnSono if hascomment = "Y:
>
>
>
>
>>>
>The code below sets the backcolor of the ColumnHasComments column to Red if the source data table record has "Y" in the hascomment field.
>>That works fine.
>>How would I set the backcolor of another column (ColumnSono) to Red for the same condition (hascomment = "Y")
>>
>>
>>
>
>> private void dataGridViewTrackingSearch_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
>> {
>> if (dataGridViewTrackingSearch.Columns[e.ColumnIndex].Name.Equals("ColumnHasComment"))
>> {
>> if (e.Value != null)
>> {
>>
>> if (e.Value.ToString() == "Y")
>> {
>> e.CellStyle.BackColor = Color.Red;
>> e.CellStyle.SelectionBackColor = Color.DarkRed;
>> }
>> }
>> }
>> } // end CellFormatting
>>
>
>
>The three chief virtues of a programmer are: Laziness, Impatience and Hubris. (Larry Wall)
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform