您好,欢迎访问三七文档
VB16PublicClassForm1DimOperatorStateAsIntegerDimdata1AsIntegerDimresultAsIntegerDimdata2AsInteger0~9PrivateSubButton1_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton1.ClickTextBox1.Text=TextBox1.Text+1EndSubPrivateSubButton2_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton2.ClickTextBox1.Text=TextBox1.Text+2EndSubPrivateSubButton3_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton3.ClickTextBox1.Text=TextBox1.Text+3EndSubPrivateSubButton4_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton4.ClickTextBox1.Text=TextBox1.Text+4EndSubPrivateSubButton5_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton5.ClickTextBox1.Text=TextBox1.Text+5EndSubPrivateSubButton6_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton6.ClickTextBox1.Text=TextBox1.Text+6EndSubPrivateSubButton7_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton7.ClickTextBox1.Text=TextBox1.Text+7EndSubPrivateSubButton8_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton8.ClickTextBox1.Text=TextBox1.Text+8EndSubPrivateSubButton9_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton9.ClickTextBox1.Text=TextBox1.Text+9EndSubPrivateSubButton10_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton10.ClickTextBox1.Text=TextBox1.Text+0EndSubPrivateSubButton15_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton15.ClickTextBox1.Text=EndSubPrivateSubButton11_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton11.Clickdata1=Val(TextBox1.Text)OperatorState=1TextBox1.Text=EndSubPrivateSubButton12_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton12.Clickdata1=Val(TextBox1.Text)OperatorState=2TextBox1.Text=EndSubPrivateSubButton13_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton13.Clickdata1=Val(TextBox1.Text)OperatorState=3TextBox1.Text=EndSubPrivateSubButton14_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton14.Clickdata1=Val(TextBox1.Text)OperatorState=4TextBox1.Text=EndSubPrivateSubButton16_Click(ByValsenderAsSystem.Object,ByValeAsSystem.EventArgs)HandlesButton16.Clickdata2=Val(TextBox1.Text)If(OperatorState=1)Thenresult=data1+data2EndIfIf(OperatorState=2)Thenresult=data1-data2EndIfIf(OperatorState=3)Thenresult=data1*data2EndIfIf(OperatorState=4)Thenresult=data1/data2EndIfTextBox1.Text=Str(result)EndSubEndClass
本文标题:VB简易计算器代码
链接地址:https://www.777doc.com/doc-1538342 .html