User Input/Output

f15e

Member
Joined
May 4, 2006
Messages
21
Programming Experience
Beginner
I am new to VB and would like some assistance in creating a form that does particular calculations given the user's input.

What I am trying to do is, within the windows form, have a box for the user to input some number value and have another box show the output of the calculation. For example, converting inches to centimeters or somethingn like that. The user inputs the inches value in a box and the equivalent centimeter value is shown in another box.

I would appreciate any help with this. Thank you.
 
add three labels to the form, add one numericupdown control to the form and add a button

label1:
Name = lblInches
Text = Inches:

Label2:
Name = lblCent
Text = Centimeters:

Label3:
Name = lblResults
Text = <none>

NumericUpDown1:
Name = nudInches
Text = 0.00

Button1:
Name = btnCalc
Text = Calculate

also be sure to arrange the labels and textboxs accordingly so the label that displays the word 'Inches:' is to the left of the nudInches nmericupdown and the label that shows the the word 'Results:' is the the left of the blank label

now double click the button and here is where you code the math for converting inches to centimeters, use the nudInches.Value property.
VB.NET:
lblResults.Text = Cstr(nudInches.Value * 2.54D)
 
Back
Top