本文介绍了如何在VB.NET中生成和十进制数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 限时删除!! 亲爱的朋友们, 我有一个疑问..如果有人知道请帮助我.... 我有2个文本框,1个列表框和1个按钮。 当我在文本框1中输入十进制数字时,结果错误.... 例如:第一个数字 10.50 第二个数字 30.20 通常正确的结果是= 40.70 但在我的程序中仅显示 40 .....不显示十进制数.....请帮助我 代码如下:Dear Friends ,I Have One Doubt..If Anyone Know Please Help Me....I Have 2 Text Boxes , 1 List Box And 1 Button .When I Enter Decimal Numbers In Textbox 1 , Result is Coming Wrong....For Exammple : First Number 10.50 Second Number 30.20Normally The Correct Result is = 40.70But In My Program Showing Only 40.....Not Showing That Decimal Numbers.....Pleae Help MeCode is Below :Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ListBox1.Items.Add(TextBox1.Text) Dim total As Integer For Each Str As String In ListBox1.Items total = total + CInt(Str) Next TextBox2.Text = total End Sub 结束班 谢谢提前..... Arjun .... SHOUTING删除 - OriginalGriff [/ edit]End ClassThanks in Advance.....Arjun....[edit] SHOUTING removed - OriginalGriff [/edit]推荐答案我理解你的问题.... 你必须在整数的地方使用双数据类型i understand your problem....you have to use double Data Type on the place of IntegerPrivate Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ClickListBox1.Items.Add(TextBox1.Text)Dim total As DoubleFor Each Str As String In ListBox1.Itemstotal = total + CDbl(Str)NextTextBox2.Text = totalEnd SubEnd Class 现在您可以检查您的解决方案Now you can check your solution 这篇关于如何在VB.NET中生成和十进制数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 1403页,肝出来的.. 09-06 23:03