LiveWire Network Peer Answers Peer Support Teen Forums Tech Forums College Forums 531 users online 211072 members 886 active today Advertise Here Sign In
TeenCollegeTechPhotos | Quizzes | LiveSecret | Memberlist | Dictionary | News | FAQ
Member Spotlight
Spice
Cool Things: Not you. =] LUCY! <3 From above: ...
Mood: Plain
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
6 online / 25 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 | Days Active: 347
Join to learn more about j3100 California, United States | Straight Male | Posts: 132 | Points: 3,628
ManicD


Swami

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 | Days Active: 882
Join to learn more about ManicD England, United Kingdom | Lesbian Male | Posts: 6,998 | Points: 26,264
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 | Days Active: 39
Join to learn more about vector3df Ontario, Canada | Straight Male | Posts: 2,242 | Points: 2,568
( 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 | Days Active: 347
Join to learn more about j3100 California, United States | Straight Male | Posts: 132 | Points: 3,628
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