LiveWire Network Peer Answers Peer Support Teen Forums Tech Forums College Forums 523 users online 225118 members 151 active today Advertise Here Sign In
TeenCollegeTechPhotos | Quizzes | LiveSecret | Memberlist | Dictionary | News | FAQ
Member Spotlight
Areola
Cool Things: Areolas.
Mood: Down
You have 1 new message.
Emergency Help
Until you sign up you can't do much. Yes, it's free.

Sign Up Now
Membername:
Password:
Already have an account?
Invite Friends
Active Members
Groups
Contests
Moderators
2 online / 45 MPM
Fresh Topics
  LiveWire / Technical Forums / Programming & Application Development / Adding Reply

Quoting Post
Archived Topic: It will not be bumped to the top of the forum.
Topic VB.net evenly divide checker
Membername   Not a member? Sign Up Free (takes 20 seconds)
Password   Forgotten your password?
Post

Font:   Size:   Color:

FAQ Keyword Search:
Post Options
Favorites Manager
Notify me of new replies to this topic by email
Notify me of new replies to this topic by private message
Original Post
j3100 Posted at 2:10 pm on Sep. 30, 2007
I'm trying to write a simple program that will check to see if a given number will divide evenly into a fixed number (no remainder).  For example I would enter a number and click a button called "check" and it would tell me yes or no weather it is evenly divided by the other number.  Does anybody know how I could do it in vb.net 2003??  I tried using an "If number = integer" but that didn't work.

Replies
j3100 Posted at 6:57 pm on Sep. 30, 2007
cool. so I got it to to divide into that number, and if it does not divide into that number evenly, it would reduce the number so it does divide evenly:

       Dim ots As Long
       ots = tbOTS.Text
       If ots Mod 101 <> 0 Then
           tbOTS.Text = ots - (ots Mod 101)
       End If

I could now easily write another if statement to alert weather it divides evenly or not.  Thanks for the help Guys!

vector3df Posted at 6:36 pm on Sep. 30, 2007
Use the modulus operator.
ManicD Posted at 2:13 pm on Sep. 30, 2007
what code have you so far?

(on LW use the [ code] type your text here [ /code] tags

All 3 previous replies displayed.