to find the input is negative or positive

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i write a number to textbox1.text

i want to learn if it is negative or positive
 
Hi bafidi,

You can either look for the negative sign or Parse the TextBox for a number and compare it to 0.

See: String.IndexOf and Int32.Parse
 
Options
1. Convert to a numeric type and do a test to see whether smaller or larger
than 0.
2. Pull as bytes and test the bytes (you can creatively use bitwise
operations ;->)

Of the two, #1 is easier, but #2 is much cooler. ;->

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top