VB2008 计算器

时间:2012-12-14 03:52:24
【文件属性】:

文件名称:VB2008 计算器

文件大小:10KB

文件格式:PNG

更新时间:2012-12-14 03:52:24

VB

纯属爱好,并非专业,请酌情下载 Public Class Form4 Private fuhao As Integer, qian As Double, danji_shu As Integer, danji_fuhao As Integer, fuhao_neibu As Integer Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click fuhao = 0 qian = 0 danji_fuhao = 0 danji_shu = 0 fuhao_neibu = 0 TextBox1.Text = 0 End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click danji_shu = 1 If danji_fuhao = 1 Then TextBox1.Text = "" TextBox1.Text = Val(TextBox1.Text + Button3.Text) danji_fuhao = 0 fuhao_neibu = 1 Else TextBox1.Text = Val(TextBox1.Text + Button3.Text) End If End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click danji_shu = 1 If danji_fuhao = 1 Then TextBox1.Text = "" TextBox1.Text = Val(TextBox1.Text + Button2.Text) danji_fuhao = 0 fuhao_neibu = 1 Else TextBox1.Text = Val(TextBox1.Text + Button2.Text) End If End Sub Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click danji_shu = 1 If danji_fuhao = 1 Then TextBox1.Text = "" TextBox1.Text = Val(TextBox1.Text + Button9.Text) danji_fuhao = 0 fuhao_neibu = 1 Else TextBox1.Text = Val(TextBox1.Text + Button9.Text) End If End Sub Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click danji_shu = 1 If danji_fuhao = 1 Then TextBox1.Text = "" TextBox1.Text = Val(TextBox1.Text + Button6.Text) danji_fuhao = 0 fuhao_neibu = 1 Else TextBox1.Text = Val(TextBox1.Text + Button6.Text) End If End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click danji_shu = 1 If danji_fuhao = 1 Then TextBox1.Text = "" TextBox1.Text = Val(TextBox1.Text + Button5.Text) danji_fuhao = 0 fuhao_neibu = 1 Else TextBox1.Text = Val(TextBox1.Text + Button5.Text) End If End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click danji_shu = 1 If danji_fuhao = 1 Then TextBox1.Text = "" TextBox1.Text = Val(TextBox1.Text + Button4.Text) danji_fuhao = 0 fuhao_neibu = 1 Else TextBox1.Text = Val(TextBox1.Text + Button4.Text) End If End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click danji_shu = 1 If danji_fuhao = 1 Then TextBox1.Text = "" TextBox1.Text = Val(TextBox1.Text + Button1.Text) danji_fuhao = 0 fuhao_neibu = 1 Else TextBox1.Text = Val(TextBox1.Text + Button1.Text) End If End Sub Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click danji_shu = 1 If danji_fuhao = 1 Then TextBox1.Text = "" TextBox1.Text = Val(TextBox1.Text + Button8.Text) danji_fuhao = 0 fuhao_neibu = 1 Else TextBox1.Text = Val(TextBox1.Text + Button8.Text) End If End Sub Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click danji_shu = 1 If danji_fuhao = 1 Then TextBox1.Text = "" TextBox1.Text = Val(TextBox1.Text + Button7.Text) danji_fuhao = 0 fuhao_neibu = 1 Else TextBox1.Text = Val(TextBox1.Text + Button7.Text) End If End Sub Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click Dim j() As Char, i As Integer, k As Integer danji_shu = 1 If danji_fuhao = 1 Then TextBox1.Text = "0" danji_fuhao = 0 fuhao_neibu = 1 Else k = 0 j = TextBox1.Text For i = 0 To Len(TextBox1.Text) - 1 If j(i) = "." Then k = k + 1 End If Next If (j(0) <> "0" And k = 0) Or k > 0 Then TextBox1.Text = TextBox1.Text + Button10.Text End If End If End Sub Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click Dim i As Integer, j() As Char, k As Integer danji_shu = 1 If danji_fuhao = 1 Then TextBox1.Text = "0." danji_fuhao = 0 fuhao_neibu = 1 Else k = 0 j = TextBox1.Text For i = 0 To Len(TextBox1.Text) - 1 If j(i) = "." Then k = k + 1 End If Next i If k = 0 Then TextBox1.Text = TextBox1.Text + Button11.Text End If End If End Sub Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click If danji_shu <> 0 Then If fuhao_neibu <> 0 Then Select Case (fuhao) Case 1 TextBox1.Text = qian / Val(TextBox1.Text) Case 2 TextBox1.Text = qian * Val(TextBox1.Text) Case 3 TextBox1.Text = qian - Val(TextBox1.Text) Case 4 TextBox1.Text = qian + Val(TextBox1.Text) End Select End If fuhao = 1 qian = Val(TextBox1.Text) danji_fuhao = 1 End If fuhao_neibu = 0 End Sub Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click If danji_shu <> 0 Then If fuhao_neibu <> 0 Then Select Case (fuhao) Case 1 TextBox1.Text = qian / Val(TextBox1.Text) Case 2 TextBox1.Text = qian * Val(TextBox1.Text) Case 3 TextBox1.Text = qian - Val(TextBox1.Text) Case 4 TextBox1.Text = qian + Val(TextBox1.Text) End Select End If fuhao = 2 qian = Val(TextBox1.Text) danji_fuhao = 1 End If fuhao_neibu = 0 End Sub Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click If danji_shu <> 0 Then If fuhao_neibu <> 0 Then Select Case (fuhao) Case 1 TextBox1.Text = qian / Val(TextBox1.Text) Case 2 TextBox1.Text = qian * Val(TextBox1.Text) Case 3 TextBox1.Text = qian - Val(TextBox1.Text) Case 4 TextBox1.Text = qian + Val(TextBox1.Text) End Select End If fuhao = 3 qian = Val(TextBox1.Text) danji_fuhao = 1 End If fuhao_neibu = 0 End Sub Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click If danji_shu <> 0 Then If fuhao_neibu <> 0 Then Select Case (fuhao) Case 1 TextBox1.Text = qian / Val(TextBox1.Text) Case 2 TextBox1.Text = qian * Val(TextBox1.Text) Case 3 TextBox1.Text = qian - Val(TextBox1.Text) Case 4 TextBox1.Text = qian + Val(TextBox1.Text) End Select End If fuhao = 4 qian = Val(TextBox1.Text) danji_fuhao = 1 End If fuhao_neibu = 0 End Sub Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click If danji_shu <> 0 Then If fuhao_neibu <> 0 Then Select Case (fuhao) Case 1 TextBox1.Text = qian / Val(TextBox1.Text) Case 2 TextBox1.Text = qian * Val(TextBox1.Text) Case 3 TextBox1.Text = qian - Val(TextBox1.Text) Case 4 TextBox1.Text = qian + Val(TextBox1.Text) End Select End If qian = Val(TextBox1.Text) danji_fuhao = 1 End If fuhao_neibu = 0 End Sub End Class


网友评论

  • 就一张图片,坑啊。。。