mod function
From: Steve (kgc71203_at_hotmail.com)
Date: 02/12/05
- Next message: Rob Bradford: "Clearing a PictureBox."
- Previous message: Jorge Serrano [MVP VB]: "RE: How to reference function in shared function?"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 12 Feb 2005 02:08:56 -0600
I am trying to get label2 to divided enely into label1. Numbers are being
randomly placed into label1 and label2. I have written the following
procedure but the numbers that are being placed in the label boxes are not
dividing evenly. Below is my code. Any help is appreciated.
Sub fillnumdiv()
'Needed to make Do While Loop work
lblNum1.Text = 3
lblNum2.Text = 2
'Make sure the top number is greater than the bottom number.
Do
'Checks all of the conditions for the number to be placed in the label box
for the first number.
If CheckBox2.Checked Then
Randomize()
lblNum1.Text = CInt(Int((TextBox2.Text * Rnd())))
ElseIf CheckBox1.Checked Then
Randomize()
lblNum1.Text = TextBox1.Text
Else
Randomize()
lblNum1.Text = CInt(Int((145 * Rnd())))
End If
' Checks all of the conditions for the number to be placed in the label box
for the second number.
If CheckBox3.Checked Then
Randomize()
lblNum2.Text = CInt(Int((TextBox3.Text * Rnd())))
ElseIf CheckBox4.Checked Then
Randomize()
lblNum2.Text = TextBox4.Text
Else
Randomize()
lblNum2.Text = CInt(Int((145 * Rnd())))
End If
Loop Until CDec(Int(lblNum1.Text) Mod Int(lblNum2.Text)) = 0 And
Int(lblNum2.Text) <> 0
End Sub
- Next message: Rob Bradford: "Clearing a PictureBox."
- Previous message: Jorge Serrano [MVP VB]: "RE: How to reference function in shared function?"
- Messages sorted by: [ date ] [ thread ]