Click here to Skip to main content
15,921,959 members
Home / Discussions / C#
   

C#

 
QuestionClick here to send data to sever!! [modified] Pin
yum 20102-Jul-10 13:13
yum 20102-Jul-10 13:13 
AnswerRe: Click here to send data to sever!! Pin
Peace ON2-Jul-10 18:34
Peace ON2-Jul-10 18:34 
GeneralRe: Click here to send data to sever!! Pin
yum 20103-Jul-10 11:26
yum 20103-Jul-10 11:26 
QuestionAmazon API and C# Pin
tonyonlinux2-Jul-10 10:16
tonyonlinux2-Jul-10 10:16 
AnswerRe: Amazon API and C# Pin
Abhinav S2-Jul-10 17:57
Abhinav S2-Jul-10 17:57 
GeneralRe: Amazon API and C# Pin
tonyonlinux2-Jul-10 18:39
tonyonlinux2-Jul-10 18:39 
QuestionChange Row background color based by cell value Pin
grmihel22-Jul-10 5:14
grmihel22-Jul-10 5:14 
AnswerRe: Change Row background color based by cell value Pin
Henry Minute2-Jul-10 7:07
Henry Minute2-Jul-10 7:07 
I have done an experiment using the good old Northwind Database Suppliers table, modifying your code to suit

Here is the code
C#
private void dataGridView1_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
    if (e.ListChangedType != ListChangedType.ItemDeleted)
    {
        DataGridViewCellStyle red = dataGridView1.DefaultCellStyle.Clone();
        red.BackColor = Color.LightPink;

        foreach (DataGridViewRow r in dataGridView1.Rows)
        {
            if (r.Cells["countryDataGridViewTextBoxColumn"].Value != null)
            {
                if (r.Cells["countryDataGridViewTextBoxColumn"].Value.ToString() == "USA")
                {
                    r.DefaultCellStyle = red;
                }
            }
        }
    }
}


It works fine.

So your problem probably lies in your if ((int)r.Cells["nummer6"].Value < 70) line.

You could try something like if ((int.TryParse(r.Cells["nummer6"].Value.ToString()) < 70), although it is a bit of a kludge.

I will continue experimenting and will come back to you if I find anything.
Henry Minute

Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
Why do programmers often confuse Halloween and Christmas? - Because 31 Oct = 25 Dec.
Business Myths of the Geek #4 'What you think matters.'

AnswerRe: Change Row background color based by cell value Pin
Henry Minute2-Jul-10 8:37
Henry Minute2-Jul-10 8:37 
GeneralRe: Change Row background color based by cell value [modified] Pin
grmihel25-Jul-10 0:43
grmihel25-Jul-10 0:43 
GeneralRe: Change Row background color based by cell value Pin
Henry Minute5-Jul-10 3:34
Henry Minute5-Jul-10 3:34 
GeneralRe: Change Row background color based by cell value Pin
grmihel26-Jul-10 3:27
grmihel26-Jul-10 3:27 
QuestionI want a Clever Text Display Pin
Nagy Vilmos2-Jul-10 5:03
professionalNagy Vilmos2-Jul-10 5:03 
AnswerRe: I want a Clever Text Display Pin
R. Giskard Reventlov2-Jul-10 5:12
R. Giskard Reventlov2-Jul-10 5:12 
AnswerRe: I want a Clever Text Display Pin
OriginalGriff2-Jul-10 5:32
mveOriginalGriff2-Jul-10 5:32 
GeneralRe: I want a Clever Text Display Pin
Nagy Vilmos2-Jul-10 5:46
professionalNagy Vilmos2-Jul-10 5:46 
AnswerRe: I want a Clever Text Display Pin
OriginalGriff2-Jul-10 5:33
mveOriginalGriff2-Jul-10 5:33 
GeneralRe: I want a Clever Text Display Pin
Nagy Vilmos2-Jul-10 5:47
professionalNagy Vilmos2-Jul-10 5:47 
GeneralRe: I want a Clever Text Display Pin
OriginalGriff2-Jul-10 5:54
mveOriginalGriff2-Jul-10 5:54 
GeneralRe: I want a Clever Text Display Pin
Nagy Vilmos2-Jul-10 7:14
professionalNagy Vilmos2-Jul-10 7:14 
AnswerRe: I want a Clever Text Display Pin
Luc Pattyn2-Jul-10 7:03
sitebuilderLuc Pattyn2-Jul-10 7:03 
GeneralRe: I want a Clever Text Display Pin
Nagy Vilmos2-Jul-10 7:12
professionalNagy Vilmos2-Jul-10 7:12 
GeneralRe: I want a Clever Text Display Pin
Luc Pattyn2-Jul-10 7:20
sitebuilderLuc Pattyn2-Jul-10 7:20 
GeneralRe: I want a Clever Text Display Pin
Nagy Vilmos2-Jul-10 10:53
professionalNagy Vilmos2-Jul-10 10:53 
GeneralRe: I want a Clever Text Display Pin
Luc Pattyn2-Jul-10 11:31
sitebuilderLuc Pattyn2-Jul-10 11:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.