利用VB制作以下

2024-11-20 01:50:37
推荐回答(2个)
回答1:

已测试。
1.
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii > 47 And KeyAscii < 58 Then
Text1.Text = "您输入的数字是:" & Chr(KeyAscii)
KeyAscii = 0
Else
Text1.Text = "您输入了非法数字"
KeyAscii = 0
End If
End Sub
2.
Private Sub Form_Load()
With Text1
.Font.Name = "隶书"
.Font.Size = 10
.ForeColor = vbRed
End With
With Text2
.Font.Name = "楷书"
.Font.Size = 20
.ForeColor = vbBlue
End With
With Text3
.Font.Name = "园幼"
.Font.Size = 30
.ForeColor = vbGreen
End With
End Sub
Private Sub Command1_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub

Private Sub Command2_Click()
End
End Sub

回答2:

问题一:text1控件 , Command控件
代码:Private Sub Command1_Click()
If Not IsNumeric(Text1) Then
MsgBox "您输入了非法数字"
Text1 = ""
Else
MsgBox (Text1)
End If
End Sub
问题二同上。。。