Calculator

xiaoxiao2021-03-06  129

Start learning VB, will put each homework here, this is a few days ago. Remember that things are made

Implement the operation of the calculator with VB

Dim num2 As DoubleDim num1 As DoubleDim intop As Integer________________________________________________________Private Sub Command1_Click () Text1.Text = "" Text1.SetFocusEnd Sub________________________________________________________Private Sub Command10_Click () If Not IsNumeric (Text1.Text) Then Text1.Text = 0 End If num1 = CDbl (Text1. Text) intop = 4 Text1.Text = "" Text1.SetFocusEnd Sub________________________________________________________Private Sub Command11_Click () Text1.Text = Text1.Text & "7" End Sub________________________________________________________Private Sub Command12_Click () Text1.Text = Text1.Text & "4" End Sub________________________________________________________Private Sub Command13_Click () Text1.Text = Text1.Text & "1" End Sub________________________________________________________Private Sub Command14_Click () If Not IsNumeric (Text1.Text) Then Text1.Text = 0 End If num2 = CDbl (Text1.Text) If intop = 1 Then Text1.Text = num1 num2 ElseIf intop = 2 Then Text1.Text = num1 - num2 ElseIf intop = 3 Then Text1.Text = num1 * num2 ElseIf intop = 4 Then Text1.Text = num1 / num2 ElseIf intop = 5 Then Text1.Text = Sqr (num1) ElseIf intop = 6 Then Text1.Text = num1 ^ num2 ElseIf intop = 7 Then Text1.Text = num1 Mod num2 Else Text1.Text = num1 num2 End IfEnd Sub________________________________________________________Private Sub Command15_Click () TEXT1.TEXT = TEXT1.TEXT & "8"

End Sub________________________________________________________Private Sub Command16_Click () Text1.Text = Text1.Text & "5" End Sub________________________________________________________Private Sub Command17_Click () Text1.Text = Text1.Text & "2" End Sub________________________________________________________Private Sub Command18_Click () Text1.Text = Text1.Text & "0 "End Sub________________________________________________________Private Sub Command19_Click () Text1.Text = Text1.Text &" 9 "End Sub________________________________________________________Private Sub Command2_Click () Form1.HideEnd Sub________________________________________________________Private Sub Command20_Click () Text1.Text = Text1.Text &" 6 "End Sub________________________________________________________Private Sub Command21_Click () Text1 .Text = Text1.Text & "3" End Sub________________________________________________________Private Sub Command22_Click () Text1.Text = Text1.Text & "." End Sub_____________ ___________________________________________Private Sub Command23_Click () If Text1.Text = "-" & CStr (Text1.Text) Then Text1.Text = CStr (Text1.Text) End If Text1.Text = "-" & Text1.TextEnd Sub________________________________________________________Private Sub Command3_Click () If NOT ISNUMERIC (TEXT1.TEXT) THEN TEXT1.TEXT = 0 End if Num1 = CDBL (Text1.Text) INTOP = 5 text1.text = ""

转载请注明原文地址:https://www.9cbs.com/read-127496.html

New Post(0)