LiveWire Network Peer Answers Peer Support Teen Forums Tech Forums College Forums 960 users online 158934 members 1459 active today Advertise Here Sign In
TeenCollegeTechPhotos | Quizzes | LiveSecret | Video | Dictionary | News | FAQ
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
5 online / 53 MPM
Fresh Topics
  LiveWire / Technical Forums / Programming & Application Development / Viewing Topic

VB.net evenly divide checker
determines weather a certain number will be evenly divided by another
Replies: 3Last Post Sep. 30, 2007 6:57pm by j3100
Single page for this topic Email Print Favorite
( j3100 )


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

2:10 pm on Sep. 30, 2007 | Joined May 2004 | 324 Days Active
Join to learn more about j3100 California, United States | Straight Male | 123 Posts | 3389 Points
ManicD


Enlightened One

Patron
Support Leader
Reply
what code have you so far?

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

-------
I touched the sky, then gave it away to make the world a lil better
LiveWire History Group
Not allowed to say lesbian anymore, Its women in comfortable shoes


2:13 pm on Sep. 30, 2007 | Joined Jan. 2006 | 648 Days Active
Join to learn more about ManicD England, United Kingdom | Male | 5702 Posts | 14364 Points
vector3df

Professional
Reply
Use the modulus operator.

-------
Duke By the Grace of His Majesty the King of the United Kingdom of Deep
Thoughts and Random Musings, Defender of the Faith

6:36 pm on Sep. 30, 2007 | Joined Sep. 2007 | 39 Days Active
Join to learn more about vector3df Ontario, Canada | Straight Male | 2242 Posts | 2568 Points
( j3100 )


Executive
Reply
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!


6:57 pm on Sep. 30, 2007 | Joined May 2004 | 324 Days Active
Join to learn more about j3100 California, United States | Straight Male | 123 Posts | 3389 Points
Single page for this topic Email Print Favorite

Quick Reply

You are signed in as our guest.

Looking for something else?
 

  LiveWire / Technical Forums / Programming & Application Development / Viewing Topic