Dim v As BooleanDim s As IntegerDim X As DoubleDim Y As DoublePrivate Sub Command1_Click(Index As Integer) If Form1.Tag = "T" Then If Index = 10 Then Text1.Text = "0" Else Text1.Text = Command1(Index).Caption End If Form1.Tag = "" Else Text1.Text = Text1.Text & Command1(Index).Caption End IfEnd SubPrivate Sub Command2_Click(Index As Integer) Form1.Tag = "T" If v Then X = Val(Text1.Text) v = Not v Else Y = Val(Text1.Text) Select Case s Case 0 Text1.Text = X + Y Case 1 Text1.Text = X - Y Case 2 Text1.Text = X * Y Case 3 If Y <> 0 Then Text1.Text = X / Y Else MsgBox ("不能以0為除數") Text1.Text = X v = False End If Case 4 Y = 0 v = False End Select X = Val(Text1.Text) End If s = IndexEnd SubPrivate Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)End Sub控制元件自己新增吧,空間名要和程式碼名一致
Dim v As BooleanDim s As IntegerDim X As DoubleDim Y As DoublePrivate Sub Command1_Click(Index As Integer) If Form1.Tag = "T" Then If Index = 10 Then Text1.Text = "0" Else Text1.Text = Command1(Index).Caption End If Form1.Tag = "" Else Text1.Text = Text1.Text & Command1(Index).Caption End IfEnd SubPrivate Sub Command2_Click(Index As Integer) Form1.Tag = "T" If v Then X = Val(Text1.Text) v = Not v Else Y = Val(Text1.Text) Select Case s Case 0 Text1.Text = X + Y Case 1 Text1.Text = X - Y Case 2 Text1.Text = X * Y Case 3 If Y <> 0 Then Text1.Text = X / Y Else MsgBox ("不能以0為除數") Text1.Text = X v = False End If Case 4 Y = 0 v = False End Select X = Val(Text1.Text) End If s = IndexEnd SubPrivate Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)End Sub控制元件自己新增吧,空間名要和程式碼名一致