Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

formating number problem 1

Status
Not open for further replies.

sthmpsn1

MIS
Sep 26, 2001
456
US
I have the following code where I am trying to display the total as a decimal number.

Dim thetotal As Single

thetotal = num(1) + num(2) + num(3) + num(4) + num(5) + num(6) + num(7) + num(8) + num(9) + num(10)
'Duties total rating
dutiesrating.Text = thetotal


'Number filled out
divmajorduties.Text = totalfilled

Dim theaverage As Decimal
Dim totalaverage As Decimal

theaverage = thetotal \ totalfilled

totalaverage = FormatNumber(theaverage, 2)
' Shows the average
averageduties.Text = totalaverage

If I do an example. thetotal holds 26.5
totalfilled holds 7
totalaverage holds 3
I want totalaverage to hold 3.78
I just can't get this to display the decimal.
 
Hee hee
This is almost funny. There are actually 2 division types in .Net / and \ Just look them up in the help it explains it.

If you want a decimal then do this instead.
theaverage = thetotal / totalfilled


I had this problem too. Apparently \ just chops off the decimals. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
I have beat my head 100 times over this and that is all it was. Thanks for the help man!!
 
np
*grin That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
thnx Jack D or D'Arcy whichever one you prefer That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top