用VB编辑以下问题

来源:百度知道 编辑:UC知道 时间:2024/05/12 00:46:04
1、单击窗体,显示你的名字,双击窗体清除显示。窗体背景颜色为红色。
2、在标准模块中编一个sub main(),在输入框(用InputBox函数)输入姓名,在输出框(用msgBox函数)显示“**(姓名),你好!!”。
3、在立即窗口测试下列各表达式的值。
(1)10\4.5
(2) “Visual” & “Basic”
(3)3<5 and 5>3
(4)4^ (-1/2)
(5)not 8>5
(6)5>3 or False
(7)25\3 mod 3.2*int(2.5)
(8)3*4>4 and 5=5
(9)sqr(8);abs(-9.2);mid(“abdisfhf”,2,3)
(10)string(3,”*”)&space(5)&string(3,”@”)
4、将一个字符串中所有的“abc”子串替换为“xy”。

1.
Private Sub Form_Click()
Print "我的名字"
End Sub

Private Sub Form_DblClick()
Me.Cls
End Sub

Private Sub Form_Load()
Me.BackColor = &HFF&
End Sub

2.
Sub main()
Dim vName As String
vName = InputBox("请输入您的姓名", "输入", "我的名字")
MsgBox vName & ",你好!!", , "您好"
End Sub

3.
Private Sub Form_Load()
'(1)10\4.5
'(2) “Visual” & “Basic”
'(3)3<5 and 5>3
'(4)4^ (-1/2)
'(5)not 8>5
'(6)5>3 or False
'(7)25\3 mod 3.2*int(2.5)
'(8)3*4>4 and 5=5
'(9)sqr(8);abs(-9.2);mid(“abdisfhf”,2,3)
'(10)string(3,”*”)&space(5)&string(3,”@”)
Debug.Print 10 \ 4.5
Debug.Print "Visual" & "Basic"
Debug.Print 3 < 5 And 5 > 3
Debug.Print 4 ^ (-1 / 2)
Debug.Print Not 8 > 5
Debug.Print 5 >