Module Calculations

kkocak

Registered User.
Local time
Today, 16:26
Joined
Jan 12, 2007
Messages
13
So i got a form with a bunch of buttons on it that do calculations of various natues (simple ones)...I typed my actual calculation codes using function in a module. For instance


Function Meter(ByVal Temp As Integer) As Integer
Temp = Temp / (3.2808)
Return Temp
End Function

That is one example of a function in my module....But when i call it in button procedure.....

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox2.Text = Format(Meter(TextBox1.Text), "Fixed")
Label1.Text = "Feet"
Label2.Text = "Meters"

It does NOT return a decimal for some reason....and yes instead of "fixed" i have tried ###.## and 000.00.....how can i get this sucker to return an actual decimal?
 
Function Meter(ByVal Temp As Integer) As Integer
 
umm...yea thats what i got....what do is wrong though?
 
Um, what Paul is saying is that your function is returning an INTEGER, which has no decimal places. You may want to change that if you want something other than whole numbers.
 
haha....nice...

thanks for the help, i think that should take care of it.....sry about being dumb
 
Actually, no problem. I've done that in the past as well. It's easy to do. So, not being dumb, just sometimes the obvious takes other eyes to spot. :)
 

Users who are viewing this thread

Back
Top Bottom