Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Problem with decimals values

Status
Not open for further replies.
Initiate Mage
Joined
Dec 29, 2013
Messages
1
Reaction score
0
First of all, im developing a program in vb.net, but the code is basically C, if its not allowed, tell me and I deleted the post, im new here!

I have the following problem:

I have 3 textboxes (Txtbox 6, 4 and 3)
I wanna do the following thing:
Textbox 6 = Textbox 3 / (Textbox4 * Textbox4)
I tried the following code:
Static c As Integer
Static d As Integer
c = TextBox4.Text * TextBox4.Text
d = TextBox3.Text
If c >= 0 <= 1000 Then
End If
If d >= 0 <= 1000 Then
End If
TextBox6.Text = d / c
But the problem is that the result is wrong (the program is only considering the entire values, not the values after the comma, for example:
Textbox 6 = 75 / 1,80 * 1,80
Textbox 6 = 75 / 3,24 (the program is considering 3, instead of 3,24)
So the result is (by the program): 25
And the correct result is: 23,1
Any clues what im doing wrong?




Nvm, I found the error and changed the code:


Static c As Decimal
Static d As Decimal


c = TextBox4.Text * TextBox4.Text
d = TextBox3.Text


If c >= 0 <= 1000 Then


End If
If d >= 0 <= 1000 Then


End If




TextBox6.Text = d / c
 
Status
Not open for further replies.
Back
Top