Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
All you have to do is convert the text in the textbox to a number and then compare it like you did.
Being smarter than you look is always better than looking smarter than you are.
  • *Experts*
Posted

something like:

If CInt(Label1.Text) < 99 And CInt(Label1.Text) > 201 Then

Label2.Text = "2"

End If

 

...CInt converts the text value to an integer value

...CDbl converts to a Double

...CByte to a Byte etc.

 

However, you might want to preceed this with a If Char.IsNumber(Label1.Text) in case the text is not numeric, thus preventing a large error message.

 

If Char.IsNumber(Label1.Text) Then
   If CInt(Label1.Text) < 99 And CInt(Label1.Text) > 201 Then
       Label2.Text = "2"
   End If
End If

Member, in good standing, of the elite fraternity of mentally challenged programmers.

 

Dolphins Software

Posted
something like:

If CInt(Label1.Text) < 99 And CInt(Label1.Text) > 201 Then

 

Erm, just a quickie, but how can a number be <99 AND >201 ?

 

Exactly what criteria are you trying to achieve? You're probably looking to use an OR, not an AND (for numbers <99 OR numbers >201)

 

However, you might actually be wanting to use an AND (for numbers >99 AND <201)

 

So, can you be a little more specific, and we can help you more!

 

B.

Posted

is there a way to use:

 

Select Case 'something

Case Is < 0 and > 200

'something = "1"

Case Is < 200 and > 300

'something = "2"

End Case

 

Could I somehow use that? Because I have used it before to convert just single numbers to other numbers.. (Example, if a 5 is entered in the textbox, i had it convert to 412)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...