我一直在阅读帮助我需要如何使用十进制货币货币确实 不存在,就像我在vb6中使用的那样。 我在google上遇到了困难msdn发现如何或者我是否可以将文本框的 值作为十进制或者我只需要再制作一个小数 变量 。所以我猜了一下,如果我在没有 波浪线的情况下打字,CDec就会变成蓝色。但这实际上是将其转换为十进制。 接下来如果是这样,我不喜欢输出文本框 总计:100 税:4.500我需要格式化为4.50 毛:95.5 分割:48这不准确,它是四舍五入的,当然应该是 95.5的一半,47.75 < code> Private Sub Button1_Click(ByVal sender As System.Object,_ ByVal e As System.EventArgs)处理btnCalc.Click ''按钮1计算 Const税为十进制= 0.045 Dim a As Integer for a = 1 to 5 lblTotal.Text = CDec(Val(lblTotal.Text))+ CDec(Val(txtCoinsInArray(a).Text)) 下一页 如果chkUncleSam.Checked = True那么 lblTax.Text = CDec( Val(lblTotal.Text))*税 结束如果 lblGross.Text = CDec(Val(lblTotal.Text)) - CDec(Val(lblTax.Text)) lblSplit.Text = CDec(Val(lblGross.Text))\ 2 结束次级 结束班级 < / code> - Adam S
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> -- Adam S
推荐答案Newbee, Net1.x使用Bankers Rounding,没有其他选择 http: //support.microsoft/default...b;en-us;196652 我希望这会有所帮助, Cor Newbee, Net1.x uses Bankers Rounding and there are no alternatives support.microsoft/default...b;en-us;196652 I hope this helps, Cor
\是整数除法?如果你尝试/改变怎么办? Patrice - Newbee Adam ; <氖******** @ discussions.microsoft> écritdansle message de news:45 ********************************* * @ microsof t ... \ is the integer division ? What if you try / instead ? Patrice -- "Newbee Adam" <Ne********@discussions.microsoft> a écrit dans le message de news:45**********************************@microsof t... 我一直在阅读帮助我需要如何使用十进制因为货币不存在,就像我在vb6中使用的那样。我有谷歌和msdn上的困难时期如何或如果我可以将文本框的值作为十进制或者我只需要制作另一个小数变量。所以我猜了一下,如果我输入没有波浪线,CDec就会变成蓝色。但这实际上是将其转换为十进制。 接下来如果是这样,我不喜欢输出到文本框总计:100 税:4.500我需要格式化为4.50 总额:95.5 分裂:48这不准确,它是四舍五入的,当然应该是95.5的一半,47.75 < code> Private Sub Button1_Click(ByVal sender As System.Object,_ ByVal e As System.EventArgs)处理btnCalc.Click ''按钮1计算 Const Tax As Decimal = 0.045 以整数为单位对于a = 1到5 lblTotal.Text = CDec(Val(lblTotal.Text))+ CDec(Val(txtCoinsInArray(a).Text ))下一页如果chkUncleSam.Checked = True那么 lblTax.Text = CDec(Val(lblTotal.Text))*税结束如果 lblGross.Text = CDec(Val(lblTotal.Text)) - CDec(Val(lblTax.Text)) lblSplit.Text = CDec(Val(lblGross.Text))\ 2 End Sub End Class < / code> - Adam S 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> -- Adam S
Super帕特里斯,这就是问题所在。我记得这个吗? 向右倾斜, 得到正确的钱!愚蠢的小记忆工具! - Adam S " Patrice"写道: Super Patrice, that was the problem. I will remeber this? "Lean right , to get the money right!" silly little memory tool! -- Adam S "Patrice" wrote: \是整数除法?如果你尝试/改变怎么办? Patrice - Newbee Adam <氖******** @ discussions.microsoft> a ??? crit dans le message de news:45 ********************************** @ microsof t ... \ is the integer division ? What if you try / instead ? Patrice -- "Newbee Adam" <Ne********@discussions.microsoft> a ??crit dans le message de news:45**********************************@microsof t... 我一直在阅读帮助我需要如何使用十进制货币 I have been reading in help how I need to use decimal becuase currency
不存在像我一样在vb6中使用。我在google和msdn上遇到困难时间如何或者如果我可以将 not exist like I used in vb6. I had a difficult time on google and msdn finding how or if I can take 文本框的值作为十进制或者我是否可以
the
只需要制作另一个小数变量。所以我猜了一下,如果我输入没有波浪线,CDec就会变成蓝色。但这实际上是将其转换为十进制。 接下来如果是这样,我不喜欢输出到文本框总计:100 税:4.500我需要格式化为4.50 总额:95.5 分裂:48这不准确,它是四舍五入的,当然应该是95.5的一半,47.75 < code> Private Sub Button1_Click(ByVal sender As System.Object,_ ByVal e As System.EventArgs)处理btnCalc.Click ''按钮1计算 Const Tax As Decimal = 0.045 以整数为单位对于a = 1到5 lblTotal.Text = CDec(Val(lblTotal.Text))+ CDec(Val(txtCoinsInArray(a).Text ))下一页如果chkUncleSam.Checked = True那么 lblTax.Text = CDec(Val(lblTotal.Text))*税结束如果 lblGross.Text = CDec(Val(lblTotal.Text)) - CDec(Val(lblTax.Text)) lblSplit.Text = CDec(Val(lblGross.Text))\ 2 End Sub End Class < / code> - Adam S
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> -- Adam S
更多推荐
需要转换并将文本框值格式化为十进制数据
发布评论