473,651 Members | 2,538 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Very odd "If value >= x" Error

I made a page with a gridview that has rows show a different color if a
number in a column is greater than or equal to 45. I also did this
conditional formatting for the column next to it. Here's my code.

in the aspx file
=============== =============== =
<asp:GridView ID="gvData" runat="server" OnRowDataBound= "doColor">
=============== =============== =

in the aspx.vb file
=============== =============== =
Sub doColor(ByVal sender As Object, ByVal e As GridViewRowEven tArgs)
If e.Row.RowType = DataControlRowT ype.DataRow Then

If e.Row.Cells(10) .Text >= "60" Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(10) .ForeColor = Drawing.Color.R ed
e.Row.Cells(10) .Font.Bold = True
End If
If e.Row.Cells(9). Text >= "45" Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(9). ForeColor = Drawing.Color.R ed
e.Row.Cells(9). Font.Bold = True
End If

End If
End Sub
=============== =============== =

The Cells(10) statement works great. Only those results that are greater
than or equal to 60 are in bold red with yellow highlight.

On the Cells(9), however, its another story. For some reason, every
result that is 5 is also bold red highlighted. I tried changing the code
to this:

If e.Row.Cells(9). Text <= "4" Then

And the 5s are no longer in bold red. In fact, if I try any of these

If e.Row.Cells(9). Text >= "9" Then
If e.Row.Cells(9). Text >= "8" Then
If e.Row.Cells(9). Text >= "7" Then
If e.Row.Cells(9). Text >= "6" Then

Then if the text in the cell is 5 it is not in bold red. Once I put in
two digits, like so ..

If e.Row.Cells(9). Text >= "10"

Then the number 5 turns bold red. It should only be bold red if it is 10
or greater!

I also tried this, which works fine; the number 5 (or any other number)
is not in bold red, only the number 55 ...

If e.Row.Cells(9). Text >= "55"

I know i'm trying to do numerical conditions on text, which seem to work
anyway for cell 10. Just to test it, I tried to convert the value of the
text to an integer before the test, like so,

If CInt(e.Row.Cell s(9).Text) >= "10"

This only returned an error and I couldn't find any other way to convert
the text into an integer to do the condition check.

Any ideas on this strange error? Its very frustrating.

TIA,
Jim
Aug 17 '06 #1
13 1539
Hi Jim,

You're not going to get the results that you desire by performing textual comparisons as if they are numeric.

You specified that you tried to convert the number but that it is failing, probably due to invalid or null data. To avoid the
conversion error first check if the Text property can be converted to an integer. If you're using the 2.0 framework you can use
Int32.TryParse, otherwise you can just catch the exception.

--
Dave Sexton

"Jim in Arizona" <ti*******@hotm ail.comwrote in message news:uG******** ******@TK2MSFTN GP06.phx.gbl...
>I made a page with a gridview that has rows show a different color if a number in a column is greater than or equal to 45. I also
did this conditional formatting for the column next to it. Here's my code.

in the aspx file
=============== =============== =
<asp:GridView ID="gvData" runat="server" OnRowDataBound= "doColor">
=============== =============== =

in the aspx.vb file
=============== =============== =
Sub doColor(ByVal sender As Object, ByVal e As GridViewRowEven tArgs)
If e.Row.RowType = DataControlRowT ype.DataRow Then

If e.Row.Cells(10) .Text >= "60" Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(10) .ForeColor = Drawing.Color.R ed
e.Row.Cells(10) .Font.Bold = True
End If
If e.Row.Cells(9). Text >= "45" Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(9). ForeColor = Drawing.Color.R ed
e.Row.Cells(9). Font.Bold = True
End If

End If
End Sub
=============== =============== =

The Cells(10) statement works great. Only those results that are greater than or equal to 60 are in bold red with yellow
highlight.

On the Cells(9), however, its another story. For some reason, every result that is 5 is also bold red highlighted. I tried
changing the code to this:

If e.Row.Cells(9). Text <= "4" Then

And the 5s are no longer in bold red. In fact, if I try any of these

If e.Row.Cells(9). Text >= "9" Then
If e.Row.Cells(9). Text >= "8" Then
If e.Row.Cells(9). Text >= "7" Then
If e.Row.Cells(9). Text >= "6" Then

Then if the text in the cell is 5 it is not in bold red. Once I put in two digits, like so ..

If e.Row.Cells(9). Text >= "10"

Then the number 5 turns bold red. It should only be bold red if it is 10 or greater!

I also tried this, which works fine; the number 5 (or any other number) is not in bold red, only the number 55 ...

If e.Row.Cells(9). Text >= "55"

I know i'm trying to do numerical conditions on text, which seem to work anyway for cell 10. Just to test it, I tried to convert
the value of the text to an integer before the test, like so,

If CInt(e.Row.Cell s(9).Text) >= "10"

This only returned an error and I couldn't find any other way to convert the text into an integer to do the condition check.

Any ideas on this strange error? Its very frustrating.

TIA,
Jim

Aug 18 '06 #2
Dave Sexton wrote:
Hi Jim,

You're not going to get the results that you desire by performing textual comparisons as if they are numeric.

You specified that you tried to convert the number but that it is failing, probably due to invalid or null data. To avoid the
conversion error first check if the Text property can be converted to an integer. If you're using the 2.0 framework you can use
Int32.TryParse, otherwise you can just catch the exception.
I did try:

If Int32.TryParse( e.Row.Cells(9). Text) >= "45" Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(9). ForeColor = Drawing.Color.R ed
e.Row.Cells(9). Font.Bold = True
End If

But when I do a blue line shows up under the line with the error:
Overload resolution failed because no accessible 'TryParse" accepts this
number of arguments.

Of course, I tried this with no Visual Studio IDE errors shown:

If CInt(e.Row.Cell s(9).Text) >= 45 Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(9). ForeColor = Drawing.Color.R ed
e.Row.Cells(9). Font.Bold = True
End If

But I get this error when I run the page:
=============== =============== ============

One of the identified items was in an invalid format.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.FormatEx ception: One of the identified items
was in an invalid format.

Source Error:
Line 8: If e.Row.RowType = DataControlRowT ype.DataRow Then
Line 9:
Line 10: If CInt(e.Row.Cell s(10).Text) >= 60 Then
Line 11: e.Row.BackColor = Drawing.Color.L ightYellow
Line 12:
=============== =============== ============

I am using the 2.0 framework and VS2005 Standard.

I don't know what to do at this point. Anyone, Anyone?
Aug 18 '06 #3
Hi Jim,

The first error (blue line) clearly states that you haven't specified all of the required arguments for the TryParse method.

Int32.TryParse on MSDN:
http://msdn2.microsoft.com/en-us/library/f02979c7.aspx

The second error, FormatException , occurs because the Text property of the cell is not returning a value that can be converted into
an integer. As I said in my previous post, you can catch the FormatException if you want, but I think TryParse is the better
choice.

--
Dave Sexton

"Jim in Arizona" <ti*******@hotm ail.comwrote in message news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
Dave Sexton wrote:
>Hi Jim,

You're not going to get the results that you desire by performing textual comparisons as if they are numeric.

You specified that you tried to convert the number but that it is failing, probably due to invalid or null data. To avoid the
conversion error first check if the Text property can be converted to an integer. If you're using the 2.0 framework you can use
Int32.TryParse , otherwise you can just catch the exception.

I did try:

If Int32.TryParse( e.Row.Cells(9). Text) >= "45" Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(9). ForeColor = Drawing.Color.R ed
e.Row.Cells(9). Font.Bold = True
End If

But when I do a blue line shows up under the line with the error:
Overload resolution failed because no accessible 'TryParse" accepts this number of arguments.

Of course, I tried this with no Visual Studio IDE errors shown:

If CInt(e.Row.Cell s(9).Text) >= 45 Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(9). ForeColor = Drawing.Color.R ed
e.Row.Cells(9). Font.Bold = True
End If

But I get this error when I run the page:
=============== =============== ============

One of the identified items was in an invalid format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for
more information about the error and where it originated in the code.

Exception Details: System.FormatEx ception: One of the identified items was in an invalid format.

Source Error:
Line 8: If e.Row.RowType = DataControlRowT ype.DataRow Then
Line 9:
Line 10: If CInt(e.Row.Cell s(10).Text) >= 60 Then
Line 11: e.Row.BackColor = Drawing.Color.L ightYellow
Line 12:
=============== =============== ============

I am using the 2.0 framework and VS2005 Standard.

I don't know what to do at this point. Anyone, Anyone?

Aug 18 '06 #4
Dave Sexton wrote:
Hi Jim,

The first error (blue line) clearly states that you haven't specified all of the required arguments for the TryParse method.

Int32.TryParse on MSDN:
http://msdn2.microsoft.com/en-us/library/f02979c7.aspx

The second error, FormatException , occurs because the Text property of the cell is not returning a value that can be converted into
an integer. As I said in my previous post, you can catch the FormatException if you want, but I think TryParse is the better
choice.
I gave this a try:
=============== =============== ==========
Sub doColor(ByVal sender As Object, ByVal e As GridViewRowEven tArgs)
If e.Row.RowType = DataControlRowT ype.DataRow Then

If Int32.TryParse( e.Row.Cells(10) .Text,
Globalization.N umberStyles.Any ) >= 60 Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(10) .ForeColor = Drawing.Color.R ed
e.Row.Cells(10) .Font.Bold = True
End If
If Int32.TryParse( e.Row.Cells(9). Text,
Globalization.N umberStyles.Any ) >= 45 Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(9). ForeColor = Drawing.Color.R ed
e.Row.Cells(9). Font.Bold = True
End If

End If
End Sub
=============== =============== ==========
Although the page loaded, no rows were highlighted or values in bold
red, even though there were matching values that should have been (for
Cells(10) OR Cells(9)).

I tried this (not the try/catch and Int32.Parse):
=============== =============== ==========
Sub doColor(ByVal sender As Object, ByVal e As GridViewRowEven tArgs)
If e.Row.RowType = DataControlRowT ype.DataRow Then
Try
If Int32.Parse(e.R ow.Cells(10).Te xt,
Globalization.N umberStyles.Any ) >= 60 Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(10) .ForeColor = Drawing.Color.R ed
e.Row.Cells(10) .Font.Bold = True
End If
If Int32.Parse(e.R ow.Cells(9).Tex t,
Globalization.N umberStyles.Any ) >= 45 Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(9). ForeColor = Drawing.Color.R ed
e.Row.Cells(9). Font.Bold = True
End If
Catch
End Try

End If
End Sub
=============== =============== ==========

But when I did this, the Cells(9) didn't work. One row that had a value
greater than 45 (the value was 55) did not change color like it should have.

Cells(10) worked as intended (as it always seems to do).

So, how could I disregard NULL values in the returned data, since this
is probably the cause of all my woes?
Aug 18 '06 #5
Hi Jim,

Your first attempt shouldn't have even built (I suspect that it did because VB doesn't require explicitly marking "out" arguments
and that's a shame). You still don't have the arguments correct for the Int32.TryParse method. Look at the link I posted for more
info.

In your second attempt you are not catching FormatException , you are catching all Exceptions. I must advise against that.

I've already answered your last question with two possible solutions. Maybe you are miscounting the row index, which is zero-based.
i.e. The first column has an index of zero, the second column has an index of one, the third column has an index of two, etc. You
also have to account for hidden columns when determining the index to be used.

--
Dave Sexton

"Jim in Arizona" <ti*******@hotm ail.comwrote in message news:ef******** ******@TK2MSFTN GP03.phx.gbl...
Dave Sexton wrote:
>Hi Jim,

The first error (blue line) clearly states that you haven't specified all of the required arguments for the TryParse method.

Int32.TryPar se on MSDN:
http://msdn2.microsoft.com/en-us/library/f02979c7.aspx

The second error, FormatException , occurs because the Text property of the cell is not returning a value that can be converted
into an integer. As I said in my previous post, you can catch the FormatException if you want, but I think TryParse is the
better choice.

I gave this a try:
=============== =============== ==========
Sub doColor(ByVal sender As Object, ByVal e As GridViewRowEven tArgs)
If e.Row.RowType = DataControlRowT ype.DataRow Then

If Int32.TryParse( e.Row.Cells(10) .Text, Globalization.N umberStyles.Any ) >= 60 Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(10) .ForeColor = Drawing.Color.R ed
e.Row.Cells(10) .Font.Bold = True
End If
If Int32.TryParse( e.Row.Cells(9). Text, Globalization.N umberStyles.Any ) >= 45 Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(9). ForeColor = Drawing.Color.R ed
e.Row.Cells(9). Font.Bold = True
End If

End If
End Sub
=============== =============== ==========
Although the page loaded, no rows were highlighted or values in bold red, even though there were matching values that should have
been (for Cells(10) OR Cells(9)).

I tried this (not the try/catch and Int32.Parse):
=============== =============== ==========
Sub doColor(ByVal sender As Object, ByVal e As GridViewRowEven tArgs)
If e.Row.RowType = DataControlRowT ype.DataRow Then
Try
If Int32.Parse(e.R ow.Cells(10).Te xt, Globalization.N umberStyles.Any ) >= 60 Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(10) .ForeColor = Drawing.Color.R ed
e.Row.Cells(10) .Font.Bold = True
End If
If Int32.Parse(e.R ow.Cells(9).Tex t, Globalization.N umberStyles.Any ) >= 45 Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(9). ForeColor = Drawing.Color.R ed
e.Row.Cells(9). Font.Bold = True
End If
Catch
End Try

End If
End Sub
=============== =============== ==========

But when I did this, the Cells(9) didn't work. One row that had a value greater than 45 (the value was 55) did not change color
like it should have.

Cells(10) worked as intended (as it always seems to do).

So, how could I disregard NULL values in the returned data, since this is probably the cause of all my woes?

Aug 18 '06 #6
Int.TryParse returns a bool so you want something like (in C#):

int Globalization.N umberStyles.Any ;
int.TryParse(e. Row.Cells(10).T ext, Globalization.N umberStyles.Any );

if (Globalization. NumberStyles.An y 45)
{
}
etc...

Jim in Arizona wrote:
Dave Sexton wrote:
>Hi Jim,

The first error (blue line) clearly states that you haven't specified
all of the required arguments for the TryParse method.

Int32.TryPar se on MSDN:
http://msdn2.microsoft.com/en-us/library/f02979c7.aspx

The second error, FormatException , occurs because the Text property of
the cell is not returning a value that can be converted into an
integer. As I said in my previous post, you can catch the
FormatExceptio n if you want, but I think TryParse is the better choice.

I gave this a try:
=============== =============== ==========
Sub doColor(ByVal sender As Object, ByVal e As GridViewRowEven tArgs)
If e.Row.RowType = DataControlRowT ype.DataRow Then

If Int32.TryParse( e.Row.Cells(10) .Text,
Globalization.N umberStyles.Any ) >= 60 Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(10) .ForeColor = Drawing.Color.R ed
e.Row.Cells(10) .Font.Bold = True
End If
If Int32.TryParse( e.Row.Cells(9). Text,
Globalization.N umberStyles.Any ) >= 45 Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(9). ForeColor = Drawing.Color.R ed
e.Row.Cells(9). Font.Bold = True
End If

End If
End Sub
=============== =============== ==========
Although the page loaded, no rows were highlighted or values in bold
red, even though there were matching values that should have been (for
Cells(10) OR Cells(9)).

I tried this (not the try/catch and Int32.Parse):
=============== =============== ==========
Sub doColor(ByVal sender As Object, ByVal e As GridViewRowEven tArgs)
If e.Row.RowType = DataControlRowT ype.DataRow Then
Try
If Int32.Parse(e.R ow.Cells(10).Te xt,
Globalization.N umberStyles.Any ) >= 60 Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(10) .ForeColor = Drawing.Color.R ed
e.Row.Cells(10) .Font.Bold = True
End If
If Int32.Parse(e.R ow.Cells(9).Tex t,
Globalization.N umberStyles.Any ) >= 45 Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(9). ForeColor = Drawing.Color.R ed
e.Row.Cells(9). Font.Bold = True
End If
Catch
End Try

End If
End Sub
=============== =============== ==========

But when I did this, the Cells(9) didn't work. One row that had a value
greater than 45 (the value was 55) did not change color like it should
have.

Cells(10) worked as intended (as it always seems to do).

So, how could I disregard NULL values in the returned data, since this
is probably the cause of all my woes?
Aug 18 '06 #7
Ooops, missed the out keyword

int Globalization.N umberStyles.Any ;
int.TryParse(e. Row.Cells(10).T ext, out Globalization.N umberStyles.Any );

if (Globalization. NumberStyles.An y 45)
{
}
Kevin Jones wrote:
Int.TryParse returns a bool so you want something like (in C#):

int Globalization.N umberStyles.Any ;
int.TryParse(e. Row.Cells(10).T ext, Globalization.N umberStyles.Any );

if (Globalization. NumberStyles.An y 45)
{
}
etc...

Jim in Arizona wrote:
>Dave Sexton wrote:
>>Hi Jim,

The first error (blue line) clearly states that you haven't specified
all of the required arguments for the TryParse method.

Int32.TryPars e on MSDN:
http://msdn2.microsoft.com/en-us/library/f02979c7.aspx

The second error, FormatException , occurs because the Text property
of the cell is not returning a value that can be converted into an
integer. As I said in my previous post, you can catch the
FormatExcepti on if you want, but I think TryParse is the better choice.

I gave this a try:
============== =============== ===========
Sub doColor(ByVal sender As Object, ByVal e As GridViewRowEven tArgs)
If e.Row.RowType = DataControlRowT ype.DataRow Then

If Int32.TryParse( e.Row.Cells(10) .Text,
Globalization. NumberStyles.An y) >= 60 Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(10) .ForeColor = Drawing.Color.R ed
e.Row.Cells(10) .Font.Bold = True
End If
If Int32.TryParse( e.Row.Cells(9). Text,
Globalization. NumberStyles.An y) >= 45 Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(9). ForeColor = Drawing.Color.R ed
e.Row.Cells(9). Font.Bold = True
End If

End If
End Sub
============== =============== ===========
Although the page loaded, no rows were highlighted or values in bold
red, even though there were matching values that should have been (for
Cells(10) OR Cells(9)).

I tried this (not the try/catch and Int32.Parse):
============== =============== ===========
Sub doColor(ByVal sender As Object, ByVal e As GridViewRowEven tArgs)
If e.Row.RowType = DataControlRowT ype.DataRow Then
Try
If Int32.Parse(e.R ow.Cells(10).Te xt,
Globalization. NumberStyles.An y) >= 60 Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(10) .ForeColor = Drawing.Color.R ed
e.Row.Cells(10) .Font.Bold = True
End If
If Int32.Parse(e.R ow.Cells(9).Tex t,
Globalization. NumberStyles.An y) >= 45 Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(9). ForeColor = Drawing.Color.R ed
e.Row.Cells(9). Font.Bold = True
End If
Catch
End Try

End If
End Sub
============== =============== ===========

But when I did this, the Cells(9) didn't work. One row that had a
value greater than 45 (the value was 55) did not change color like it
should have.

Cells(10) worked as intended (as it always seems to do).

So, how could I disregard NULL values in the returned data, since this
is probably the cause of all my woes?
Aug 18 '06 #8
Hi Kevin,

Your example wouldn't even compile.

System.Globaliz ation.NumberSty les is an enumeration, not a variable name. Also, the method returns a Boolean, as you mentioned, but
in your example your not event using it.

Int32.TryParse method on MSDN:
http://msdn2.microsoft.com/en-us/library/f02979c7.aspx

I recommend taking a look.

--
Dave Sexton

"Kevin Jones" <kj****@develop .comwrote in message news:%2******** ********@TK2MSF TNGP02.phx.gbl. ..
Ooops, missed the out keyword

int Globalization.N umberStyles.Any ;
int.TryParse(e. Row.Cells(10).T ext, out Globalization.N umberStyles.Any );

if (Globalization. NumberStyles.An y 45)
{
}
Kevin Jones wrote:
>Int.TryParse returns a bool so you want something like (in C#):

int Globalization.N umberStyles.Any ;
int.TryParse(e .Row.Cells(10). Text, Globalization.N umberStyles.Any );

if (Globalization. NumberStyles.An y 45)
{
}
etc...

Jim in Arizona wrote:
>>Dave Sexton wrote:
Hi Jim,

The first error (blue line) clearly states that you haven't specified all of the required arguments for the TryParse method.

Int32.TryPar se on MSDN:
http://msdn2.microsoft.com/en-us/library/f02979c7.aspx

The second error, FormatException , occurs because the Text property of the cell is not returning a value that can be converted
into an integer. As I said in my previous post, you can catch the FormatException if you want, but I think TryParse is the
better choice.
I gave this a try:
============= =============== ============
Sub doColor(ByVal sender As Object, ByVal e As GridViewRowEven tArgs)
If e.Row.RowType = DataControlRowT ype.DataRow Then

If Int32.TryParse( e.Row.Cells(10) .Text, Globalization.N umberStyles.Any ) >= 60 Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(10) .ForeColor = Drawing.Color.R ed
e.Row.Cells(10) .Font.Bold = True
End If
If Int32.TryParse( e.Row.Cells(9). Text, Globalization.N umberStyles.Any ) >= 45 Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(9). ForeColor = Drawing.Color.R ed
e.Row.Cells(9). Font.Bold = True
End If

End If
End Sub
============= =============== ============
Although the page loaded, no rows were highlighted or values in bold red, even though there were matching values that should
have been (for Cells(10) OR Cells(9)).

I tried this (not the try/catch and Int32.Parse):
============= =============== ============
Sub doColor(ByVal sender As Object, ByVal e As GridViewRowEven tArgs)
If e.Row.RowType = DataControlRowT ype.DataRow Then
Try
If Int32.Parse(e.R ow.Cells(10).Te xt, Globalization.N umberStyles.Any ) >= 60 Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(10) .ForeColor = Drawing.Color.R ed
e.Row.Cells(10) .Font.Bold = True
End If
If Int32.Parse(e.R ow.Cells(9).Tex t, Globalization.N umberStyles.Any ) >= 45 Then
e.Row.BackColor = Drawing.Color.L ightYellow
e.Row.Cells(9). ForeColor = Drawing.Color.R ed
e.Row.Cells(9). Font.Bold = True
End If
Catch
End Try

End If
End Sub
============= =============== ============

But when I did this, the Cells(9) didn't work. One row that had a value greater than 45 (the value was 55) did not change color
like it should have.

Cells(10) worked as intended (as it always seems to do).

So, how could I disregard NULL values in the returned data, since this is probably the cause of all my woes?

Aug 18 '06 #9
Dave Sexton wrote:
Your example wouldn't even compile.
I'm typing the code into notepad - I was just trying to get across the
idea that you can't use the return from TryParse as that is a bool, but
instead need to set the "out" variable to get the actual result of
TryParse.
System.Globaliz ation.NumberSty les is an enumeration, not a variable
name.
I didn't bother checking the type of the variable he was using, assuming
it would be an int
Also, the method returns a Boolean, as you mentioned, but
in your example your not event using it.
And in this case I don't need to. if the method fails then the value
being set will still be 0 which is less than 45 the last time I looked!
I recommend taking a look.
Thanks for the advice but I now exactly how it works.
Hi Kevin,
System.Globaliz ation.NumberSty les is an enumeration, not a variable name. Also, the method returns a Boolean, as you mentioned, but
in your example your not event using it.

Int32.TryParse method on MSDN:
http://msdn2.microsoft.com/en-us/library/f02979c7.aspx

Aug 18 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2355
by: lvcha.gouqizi | last post by:
I embed an applet in my php script which has a parameter providing an input file for the jar. Does this file has size limit? The code is as follows: <APPLET ARCHIVE="myapplet.jar" WIDTH=372 HEIGHT=360 VSPACE=0 HSPACE=0 ALIGN=middle> <?php echo "<PARAM NAME=\"data\" VALUE=\"myfile.\">";?> when "myfile" is beyond 15M, my applet cannot load sucessfully, but
1
6819
by: Christian Schmidbauer | last post by:
Hello! I prepare my XML document like this way: ------------------------------------------------------- PrintWriter writer; Document domDocument; Element domElement; // Root tag
7
2086
by: Diandian Zhang | last post by:
Does anyone have an idea, how to do it? Thanks in advance!
40
3021
by: Steve Juranich | last post by:
I know that this topic has the potential for blowing up in my face, but I can't help asking. I've been using Python since 1.5.1, so I'm not what you'd call a "n00b". I dutifully evangelize on the goodness of Python whenever I talk with fellow developers, but I always hit a snag when it comes to discussing the finer points of the execution model (specifically, exceptions). Without fail, when I start talking with some of the "old-timers"...
16
4469
by: Tantale | last post by:
I used this serviec to check my webpage http://www.jmrw.com/Abroad/Barcelone/index.htm Made with Dreamweaver 8. The result is 206 errors, most of them "end tag omitted, but OMITTAG NO was specified.". I don't understand this result. Should I modify something ? Thanks
15
2668
by: arnuld | last post by:
-------- PROGRAMME ----------- /* Stroustrup, 5.6 Structures STATEMENT: this programmes *tries* to do do this in 3 parts: 1.) it creates a "struct", named "jd", of type "address". 2. it then adds values to "jd" 3.) in the end it prints values of "jd".
11
8320
by: jjw92 | last post by:
I've been banging my head against the wall with this one for a couple days so I'm hoping someone has some ideas. I have a web service that I created that is called by a .NET class library (which in turn is called by another application). This all works fine in my development environment. Test environment: Windows Server 2003, ASP 6.0, .NET 2.0, Anonymous authentication is enabled. All components (web service, DLL, and calling application)...
2
4427
by: Colonel | last post by:
It seems that the problems have something to do with the overloading of istream operator ">>", but I just can't find the exact problem. // the declaration friend std::istream & operator>(std::istream & in, const Complex & a); // the methods correspond to the friend std::istream & operator>(std::istream & in, const Complex & a) { std::cout << "real: ";
1
14028
by: ChollaPete | last post by:
This code: <form action="processScan.php" method="get"> <p> <?php print "Scan name: <input type=\"file\" name=\"tScanFileName\" value= \"{$scanFileName}\"><br>"; addHiddenCarryons(); ?> <input type="submit">
0
8347
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8275
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8792
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8694
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7294
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6157
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5605
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4143
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1905
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.