VB~窗体上包含二个文本框,在text1输入数字1-2,单击command1命令按钮,则在text2中显示对应的星期几

如题
2024-12-18 13:34:42
推荐回答(1个)
回答1:

Private Sub Command1_Click()
If Text1.Text = "" Then
Text1.SetFocus
Else
Text2.Text = "星期" & Text1.Text
End If
End Sub

Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Text1.MaxLength = 1
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
Select Case Chr(KeyAscii)
Case "1" To "7", Chr(8)
Case Else
KeyAscii = 0
End Select
End Sub