Comparing Calculated Values

J. D. JAckson

New member
Joined
Sep 16, 2005
Messages
1
Location
Deer Park, Texas
Programming Experience
1-3
I am new to VB.Net and working through some issues about comparing calulated values produced in function routines I have written when I click a button.

I have witten the following to compare the values and display a panel if the values are true. The result of the function routines is set to Single.

If PS.Text > P.Text Then
Panel1.Visible = True
Else
Panel1.Visible = False
End If

All the function routines operate correctly and this is the only issue I have with the program I am writing.

Any Help would be greatly appreciated.
 
if i'm understanding this correctly:

you have two values calculated somewhere in the program and the result's are store in the textbox's correct?

if that's the case couldnt you just compair those two numeric variables to determin the visibility of the panel?

ie: instead of PS.Text and P.Text use the variables:

If (variable used for PS) > (variable used for P) Then...

if not then you could convert the Text properties of the textboxes to numeric values then compair those

ie: If Val(PS.Text) > Val(P.Text) Then....

does this help any?
 
Agreed - be careful about comparing numbers vs. comparing text, and storing info in fields vs safely in variables of the correct type. If this is really text you want to compare, then look up Option Compare in the docs, to see more about string comparison. Option Compare will set the behavior of string comparison to binary or text, which might help.
 
Back
Top