Hi guys does anybody know how i can make it divide the numbers put in text1 and text 2?
for example
text 1 = 100
text 2 = 4
when command1 is pressed it then divides text1 by text2
any ideas?
thanks
Jamie
Printable View
Hi guys does anybody know how i can make it divide the numbers put in text1 and text 2?
for example
text 1 = 100
text 2 = 4
when command1 is pressed it then divides text1 by text2
any ideas?
thanks
Jamie
Code:Dim dblResult As Double
dblResult = Val(Text1.Text) / Val(Text2.Text)
fantastic thank you, by anychance do you know how i can make it choose the number to divide it by automatically?
Basically i have 2 dtpicker boxes and a user selects 2 diffrent dates, is it possible to make it divide it by the number of different days?
For example dtpicker1 = 08/04/2012 and dtpicker2 = 10/04/2012
it will know to divide it by 2 as thats the day difference?
Thanks
Jamie
Use the DateDiff function to find out the amount of days
Try this
Code:Dim dblResult As Double
dblResult = Val(Text1.Text) / DateDiff("d", "08/04/2012", "10/04/2012") ' Replace dates with dtpicker1 & dtpicker2
Hi mate,
For some reason the code you provided is not returning any values, so it is just displaying empty results and not actually showing any numbers.
Any ideas?
The returning value is stored in the variable dblResult, so you have to show it in a control like Text box or Label, e.g.
Text2.Text = CStr(dblResult)