I have been reading in help how I need to use decimal becuase currency does
not exist like I used in vb6.
I had a difficult time on google and msdn finding how or if I can take the
value of text box as decimal or do I just have to make another decimal
variable
. So I took a guess hoping CDec would come up blue if I type it in with no
squigglies on the line. But is this actually converting it to decimal.
Next if so, I do not like the out put to the textboxes
Total: 100
Tax: 4.500 I need it formatted as 4.50
Gross: 95.5
Split: 48 This is not accurate, it is rounding, It should be of course
half of 95.5, 47.75
<code>
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnCalc.Click
'Button 1 Calculate
Const Tax As Decimal = 0.045
Dim a As Integer
For a = 1 To 5
lblTotal.Text = CDec(Val(lblTotal.Text)) +
CDec(Val(txtCoinsInArray(a).Text))
Next
If chkUncleSam.Checked = True Then
lblTax.Text = CDec(Val(lblTotal.Text)) * Tax
End If
lblGross.Text = CDec(Val(lblTotal.Text)) - CDec(Val(lblTax.Text))
lblSplit.Text = CDec(Val(lblGross.Text)) \ 2
End Sub
End Class
</code>

Signature
Adam S
Cor Ligthert - 20 Jun 2005 17:14 GMT
Newbee,
Net1.x uses Bankers Rounding and there are no alternatives
http://support.microsoft.com/default.aspx?scid=kb;en-us;196652
I hope this helps,
Cor
Patrice - 20 Jun 2005 17:20 GMT
\ is the integer division ? What if you try / instead ?
Patrice
> I have been reading in help how I need to use decimal becuase currency does
> not exist like I used in vb6.
[quoted text clipped - 29 lines]
> End Class
> </code>
Newbee Adam - 20 Jun 2005 17:48 GMT
Super Patrice, that was the problem. I will remeber this? "Lean right , to
get the money right!" silly little memory tool!

Signature
Adam S
> \ is the integer division ? What if you try / instead ?
>
[quoted text clipped - 35 lines]
> > End Class
> > </code>
Newbee Adam - 20 Jun 2005 17:51 GMT
is Cdec correct to convert decimal datatype, I could not find it in help?

Signature
Adam S
> Super Patrice, that was the problem. I will remeber this? "Lean right , to
> get the money right!" silly little memory tool!
[quoted text clipped - 38 lines]
> > > End Class
> > > </code>
Patrice - 20 Jun 2005 18:00 GMT
This is part of the VB.NET language (i.e. you'll find in the VB.NET language
specification not in the framework class library doc) :
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vblr7/html/vaGr
pTypeConversion.asp

Signature
Patrice
> is Cdec correct to convert decimal datatype, I could not find it in help?
>
[quoted text clipped - 40 lines]
> > > > End Class
> > > > </code>
Newbee Adam - 20 Jun 2005 17:57 GMT
is Cdec correct for decimal. I search in help and could not find? I just
guess.

Signature
Adam S
> \ is the integer division ? What if you try / instead ?
>
[quoted text clipped - 35 lines]
> > End Class
> > </code>