vb 在文本框输入单词,用空格隔开,按统计键统计单词最长的单词,输入在标签栏里。按清除键清除文本
1个回答
展开全部
假定文本框为Text1、标签栏为Label1
Private Sub Command1_Click() '统计键
Dim s() As String, i As Long, t As String
s = Split(Text1.Text, " ")
For i = 0 To UBound(s)
If Len(s(i)) > Len(t) Then t = s(i)
Next
Label1.Caption = t
End Sub
Private Sub Command2_Click() '清除键
Text1.Text = ""
Label1.Caption = ""
End Sub
Private Sub Command3_Click() '退出键
End
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询