LiveWire Network Peer Answers Peer Support Teen Forums Tech Forums College Forums 850 users online 186435 members 1849 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
10 online / 28 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
Welcome to LiveWire!
We're Stronger Together.
Join the Community
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 | 331 Days Active
Join to learn more about j3100 California, United States | Straight Male | 126 Posts | 3462 Points
ManicD


Omnipotent One

Patron
Support Leader
Reply
what code have you so far?

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

-------
---Suggestions wanted to fill this gap, PM me---


2:13 pm on Sep. 30, 2007 | Joined Jan. 2006 | 798 Days Active
Join to learn more about ManicD England, United Kingdom | Lesbian Male | 6860 Posts | 18727 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 | 331 Days Active
Join to learn more about j3100 California, United States | Straight Male | 126 Posts | 3462 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