Jump to content
Xtreme .Net Talk

Recommended Posts

  • *Experts*
Posted

I believe you've got your Boolean and Integer swapped.

Try this:

Dim MyInt As Integer
       Dim MyRes As Boolean = Integer.TryParse(NumericUpDown1.Value, MyInt)
       If MyInt < 1 Or MyInt > 65535 Then
           MsgBox("invalid number")
       End If

 

The second param to TryParse is the parsed integer value. The return of the function is true/false on whether the parsing worked.

 

Also, it looks like you want to parse a short integer. Maybe replace Integer with UShort above. Then you'd only have to check against 0 (if that's an invalid value for you). Just an observation, not critical to your question.

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut

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...