So working on something and it is running on asp.net so this page is refreshing a lot.

It has numbers in a textbox that have been counted and keep changing all day long.
What I want to so the textbox witht he highest number is turned green.

int[] MyNumbers = new int[] { Convert.ToInt32(Line1Scale1.Text), Convert.ToInt32(Line1Scale2.Text), Convert.ToInt32(Line1Scale3.Text), Convert.ToInt32(Line1Scale4.Text), 
                Convert.ToInt32(Line1Scale5.Text), Convert.ToInt32(Line1Scale6.Text), Convert.ToInt32(Line1Scale7.Text), Convert.ToInt32(Line2Scale1.Text), Convert.ToInt32(Line2Scale2.Text), Convert.ToInt32(Line2Scale3.Text), Convert.ToInt32(Line2Scale4.Text), 
                Convert.ToInt32(Line2Scale5.Text), Convert.ToInt32(Line2Scale6.Text), Convert.ToInt32(Line2Scale7.Text),Convert.ToInt32(Line3Scale1.Text), Convert.ToInt32(Line3Scale2.Text), Convert.ToInt32(Line3Scale3.Text), Convert.ToInt32(Line3Scale4.Text), 
                Convert.ToInt32(Line3Scale5.Text), Convert.ToInt32(Line3Scale6.Text), Convert.ToInt32(Line3Scale7.Text),Convert.ToInt32(Line4Scale1.Text), Convert.ToInt32(Line4Scale2.Text), Convert.ToInt32(Line4Scale3.Text), Convert.ToInt32(Line4Scale4.Text), 
                Convert.ToInt32(Line4Scale5.Text), Convert.ToInt32(Line4Scale6.Text), Convert.ToInt32(Line4Scale7.Text),Convert.ToInt32(Line5Scale1.Text), Convert.ToInt32(Line5Scale2.Text), Convert.ToInt32(Line5Scale3.Text), Convert.ToInt32(Line5Scale4.Text), 
                Convert.ToInt32(Line5Scale5.Text), Convert.ToInt32(Line5Scale6.Text), Convert.ToInt32(Line5Scale7.Text),Convert.ToInt32(Line7Scale1.Text), Convert.ToInt32(Line7Scale2.Text), Convert.ToInt32(Line7Scale3.Text), Convert.ToInt32(Line7Scale4.Text), 
                Convert.ToInt32(Line7Scale5.Text), Convert.ToInt32(Line7Scale6.Text), Convert.ToInt32(Line7Scale7.Text) };
            Array.Sort(MyNumbers);
            MyNumbers.Max();

That is what I have so far. I do not know where to go from there. I know will grab the top number but how would I change that ones color to green? Any help?

Make an array of your textboxes and color the textbox with the maximum in it.
LineXScaleY screams out to be an array.

A simple little routine like this will loop through the textboxes and set the backcolor of the one with the highest value:

    Dim MaxTB As New TextBox()
    MaxTB.Text = "0"
    For Each tb As TextBox In Me.Controls.OfType(Of TextBox)()
        Dim MaxValue As Double = 0
        If tb.Name.StartsWith("Line") AndAlso Double.TryParse(tb.Text, MaxValue) AndAlso MaxValue > Double.Parse(MaxTB.Text) Then
            MaxTB = tb
        End If
    Next
    MaxTB.BackColor = Color.Green

You have to reduce your postbacks while calculating the maximum value.

So My suggestion is to use a javascript to get the value and do the following.

1) Store the data in an array as ddanbe said. The array will look like [12,2554,523,..].
2) Use the following code to get the max

Array.max = function( array )
{
return Math.max.apply( Math, array );
};

and regarding the color change, use a CSS class

CSS
.max 
{
  border:2px solid green;
}
javascript
if(condition) 'to check the max number
{
document.getElementById("num1").className = document.getElementById("fName").className + " max";
}

Hope this helps you my friend...:-D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.