Newb Question

Jase3085

New member
Joined
Mar 4, 2005
Messages
4
Location
NZ
Programming Experience
Beginner
Hey,

I have a textbox, and im trying to create the code to calculate ' for every '100' entered in the textbox, i want + 1 to another line of code
So if someone entered 500 in the textbox i would like + 5 to be added to a seperate calculation
Ive been experimenting with creating Dims, one for the appropriate units and one for the increase

Dim Units As Decimal ' Units i would like to divide by, divide by 100?'
Dim Increase As Decimal ' Proportionate increase by 1'

Units = 100D
Increase = 1 'This is redundent right?, i could just + 1?'

Am i taking the right approach to this situation?, any help much appreciated

-Jase
 

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
VB.NET:
Increase = System.Math.Round(Units / 100)
'Increase = System.Math.ToCeiling(Units / 100) 'If decimal, rounds up to next whole number
'Increase = System.Math.ToFloor(Units / 100) ' If decimal, rounds down to next whole number
 
Top Bottom