[.NET] vb2005寫的計算機...

看板Visual_Basic作者 (好累喔.....)時間17年前 (2008/06/18 23:18), 編輯推噓1(102)
留言3則, 3人參與, 最新討論串1/1
請輸入專案類型(網站專案或者應用程式專案):vb05 windows應用程式 我有看到版上的人在討論VB06 我是用vb2005的 在嘗試改寫後 還是有些地方沒有改好 麻煩知道的人幫我解答一下! 謝謝!^^ Public Class Form1 Dim p, q, o, r, X As Integer, a(1 To 2) As Double Private Sub 1_Click(ByVal z As Integer) Select Case z Case Is <= 9 If o = 1 Then p = 0 o = 0 a(1) = 0 a(2) = 0 End If End Select Select Case p Case 0 Select Case z Case 0 a(1) = Str(a(1)) & 0 Text1.Text = a(1) Case 1 a(1) = Str(a(1)) & 1 Text1.Text = a(1) Case 2 a(1) = Str(a(1)) & 2 Text1.Text = a(1) Case 3 a(1) = Str(a(1)) & 3 Text1.Text = a(1) Case 4 a(1) = Str(a(1)) & 4 Text1.Text = a(1) Case 5 a(1) = Str(a(1)) & 5 Text1.Text = a(1) Case 6 a(1) = Str(a(1)) & 6 Text1.Text = a(1) Case 7 a(1) = Str(a(1)) & 7 Text1.Text = a(1) Case 8 a(1) = Str(a(1)) & 8 Text1.Text = a(1) Case 9 a(1) = Str(a(1)) & 9 Text1.Text = a(1) End Select Case 1 Select Case z Case 0 a(2) = Str(a(2)) & 0 Text1.Text = a(2) r = 1 Case 1 a(2) = Str(a(2)) & 1 Text1.Text = a(2) r = 1 Case 2 a(2) = Str(a(2)) & 2 Text1.Text = a(2) r = 1 Case 3 a(2) = Str(a(2)) & 3 Text1.Text = a(2) r = 1 Case 4 a(2) = Str(a(2)) & 4 Text1.Text = a(2) r = 1 Case 5 a(2) = Str(a(2)) & 5 Text1.Text = a(2) r = 1 Case 6 a(2) = Str(a(2)) & 6 Text1.Text = a(2) r = 1 Case 7 a(2) = Str(a(2)) & 7 Text1.Text = a(2) r = 1 Case 8 a(2) = Str(a(2)) & 8 Text1.Text = a(2) r = 1 Case 9 a(2) = Str(a(2)) & 9 Text1.Text = a(2) r = 1 End Select End Select Select Case z Case 10 If o = 1 Then Else If p = 1 Then If r = 0 Then a(2) = Text1.Text r = 1 End If Select Case q Case 1 a(1) = a(1) + a(2) Case 2 a(1) = a(1) - a(2) Case 3 a(1) = a(1) * a(2) Case 4 If a(2) = 0 Then Text1.Text = "函數結果未定義" Else a(1) = a(1) / a(2) End If End Select Text1.Text = a(1) End If End If a(2) = 0 p = 1 q = 1 o = 0 r = 0 Case 11 If o = 1 Then Else If p = 1 Then If r = 0 Then a(2) = Text1.Text r = 1 End If Select Case q Case 1 a(1) = a(1) + a(2) Case 2 a(1) = a(1) - a(2) Case 3 a(1) = a(1) * a(2) Case 4 If a(2) = 0 Then Text1.Text = "函數結果未定義" Else a(1) = a(1) / a(2) End If End Select Text1.Text = a(1) End If End If a(2) = 0 p = 1 q = 2 o = 0 r = 0 Case 12 If o = 1 Then Else If p = 1 Then If r = 0 Then a(2) = Text1.Text r = 1 End If Select Case q Case 1 a(1) = a(1) + a(2) Case 2 a(1) = a(1) - a(2) Case 3 a(1) = a(1) * a(2) Case 4 If a(2) = 0 Then Text1.Text = "函數結果未定義" Else a(1) = a(1) / a(2) End If End Select Text1.Text = a(1) End If End If a(2) = 0 p = 1 q = 3 o = 0 r = 0 Case 13 If o = 1 Then Else If p = 1 Then If r = 0 Then a(2) = Text1.Text r = 1 End If Select Case q Case 1 a(1) = a(1) + a(2) Case 2 a(1) = a(1) - a(2) Case 3 a(1) = a(1) * a(2) Case 4 If a(2) = 0 Then Text1.Text = "函數結果未定義" Else a(1) = a(1) / a(2) End If End Select Text1.Text = a(1) End If End If a(2) = 0 p = 1 q = 4 o = 0 r = 0 Case 14 If r = 0 Then a(2) = Text1.Text r = 1 End If Select Case q Case 1 a(1) = a(1) + a(2) Case 2 a(1) = a(1) - a(2) Case 3 a(1) = a(1) * a(2) Case 4 If a(2) = 0 Then Text1.Text = "函數結果未定義" Else a(1) = a(1) / a(2) End If End Select Text1.Text = a(1) o = 1 Case 15 Select Case p Case 0 a(1) = 0 a(2) = 0 p = 0 q = 0 o = 0 r = 0 Text1.Text = 0 Case 1 a(2) = 0 o = 0 r = 0 Text1.Text = 0 End Select Case 16 a(1) = 0 a(2) = 0 p = 0 q = 0 o = 0 r = 0 Text1.Text = 0 Case 17 If o = 1 Then Else Y = Str(Text1.Text) X = Len(Y) Select Case p Case 0 If X - 1 = 1 Then Text1.Text = 0 a(1) = 0 Else a(1) = Left(Y, X - 1) Text1.Text = a(1) End If Case 1 If X - 1 = 1 Then Text1.Text = 0 a(2) = 0 Else a(2) = Left(Y, X - 1) Text1.Text = a(2) End If End Select End If End Select End Sub End Class -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.216.5.208

06/19 01:00, , 1F
有VB06嗎?不是VB08喔?
06/19 01:00, 1F

06/19 07:00, , 2F
打錯打錯...是6.0啦.....= ="
06/19 07:00, 2F

06/19 11:41, , 3F
感覺好多Magic Number..建議稍為標一下註解和程式想法...^^
06/19 11:41, 3F
文章代碼(AID): #18MIT0WM (Visual_Basic)