VB的Text1.text输入数字
选中option1,点cmdbutton1,text2.text呈逆序输出选中option2,点cmdbutton1,text2.text呈各数字的和选中option3,...
选中option1,点cmdbutton1,text2.text呈逆序输出
选中option2,点cmdbutton1,text2.text呈各数字的和
选中option3,点cmdbutton1,text2.text呈各数字的积
备注:不使用函数,用最基本的方法,求的结果
感激不尽,紧急求救!!! 展开
选中option2,点cmdbutton1,text2.text呈各数字的和
选中option3,点cmdbutton1,text2.text呈各数字的积
备注:不使用函数,用最基本的方法,求的结果
感激不尽,紧急求救!!! 展开
2个回答
展开全部
Dim str
Private Sub Form_load()
Text1 = ""
Text2 = ""
Option1.Caption = "逆序"
Option2.Caption = "求和"
Option3.Caption = "求积"
End Sub
Private Sub Option1_Click()
str = Text1.Text
Text2 = StrReverse(str)
End Sub
Private Sub Option2_Click()
Text2.Text = Val(Text1.Text) + Val(Text2.Text)
End Sub
Private Sub Option3_Click()
str = Text1.Text
Text2 = StrReverse(str)
Text2.Text = Val(Text1.Text) * Val(Text2.Text)
End Sub
这够简单基本了吧。。你只要添加2个文本 3个单选 连名字我都给你设定好了
如果你要限制输入的只是数字 你也可以用下面的代码
Dim str
Private Sub Form_load()
Text1 = ""
Text2 = ""
Option1.Caption = "逆序"
Option2.Caption = "求和"
Option3.Caption = "求积"
End Sub
Private Sub Option1_Click()
str = Text1.Text
If IsNumeric(Text1.Text) = False Then
MsgBox "非数字请重新输入"
Else
Text2 = StrReverse(str)
End If
End Sub
Private Sub Option2_Click()
If IsNumeric(Text1.Text) = False Then
MsgBox "非数字请重新输入"
Else
Text2.Text = Val(Text1.Text) + Val(Text2.Text)
End If
End Sub
Private Sub Option3_Click()
If IsNumeric(Text1.Text) = False Then
MsgBox "非数字请重新输入"
Else
str = Text1.Text
Text2 = StrReverse(str)
Text2.Text = Val(Text1.Text) * Val(Text2.Text)
End If
End Sub
Private Sub Form_load()
Text1 = ""
Text2 = ""
Option1.Caption = "逆序"
Option2.Caption = "求和"
Option3.Caption = "求积"
End Sub
Private Sub Option1_Click()
str = Text1.Text
Text2 = StrReverse(str)
End Sub
Private Sub Option2_Click()
Text2.Text = Val(Text1.Text) + Val(Text2.Text)
End Sub
Private Sub Option3_Click()
str = Text1.Text
Text2 = StrReverse(str)
Text2.Text = Val(Text1.Text) * Val(Text2.Text)
End Sub
这够简单基本了吧。。你只要添加2个文本 3个单选 连名字我都给你设定好了
如果你要限制输入的只是数字 你也可以用下面的代码
Dim str
Private Sub Form_load()
Text1 = ""
Text2 = ""
Option1.Caption = "逆序"
Option2.Caption = "求和"
Option3.Caption = "求积"
End Sub
Private Sub Option1_Click()
str = Text1.Text
If IsNumeric(Text1.Text) = False Then
MsgBox "非数字请重新输入"
Else
Text2 = StrReverse(str)
End If
End Sub
Private Sub Option2_Click()
If IsNumeric(Text1.Text) = False Then
MsgBox "非数字请重新输入"
Else
Text2.Text = Val(Text1.Text) + Val(Text2.Text)
End If
End Sub
Private Sub Option3_Click()
If IsNumeric(Text1.Text) = False Then
MsgBox "非数字请重新输入"
Else
str = Text1.Text
Text2 = StrReverse(str)
Text2.Text = Val(Text1.Text) * Val(Text2.Text)
End If
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询