carloscarli
Virtual Store Owner
2
MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1
100 XP
Introduction:
This tutorial is on how to create a simple tool in Visual Basic to check whether the entered number is even or odd.
Design:
For this program, we need a couple of components;
Button, button1, Begin the checking process.
NumericUpDown, numericUpDown1, Hold the number value.
Button Click:
Once the button is clicked, we first want to create a new integer variable and set it equal to the value of the numericupdown control...
Next we want to write a simple if statement using the MOD operator to see if the integer variable, MOD 2, is true or not. If it is, the number is even, otherwise it is false...
Finished!
This tutorial is on how to create a simple tool in Visual Basic to check whether the entered number is even or odd.
Design:
For this program, we need a couple of components;
Button, button1, Begin the checking process.
NumericUpDown, numericUpDown1, Hold the number value.
Button Click:
Once the button is clicked, we first want to create a new integer variable and set it equal to the value of the numericupdown control...
- Dim
num As
Integer
= numericUpDown1.Value
Next we want to write a simple if statement using the MOD operator to see if the integer variable, MOD 2, is true or not. If it is, the number is even, otherwise it is false...
- If
((num Mod
2) = 0) Then
- MsgBox("Even"
)
- Else
- MsgBox("Odd"
)
- End
If
Finished!