VB点击按钮一在标签中随机生成8个字母,单击按钮二取最小的字母在列表框中显示,代码怎么打?
2个回答
展开全部
Private Sub Command1_Click()
Randomize
For i = 1 To 8
Label1.Caption = Label1.Caption & Chr(Int(Rnd * 26) + 65) & " "
Next i
End Sub
Private Sub Command2_Click()
c = Left(Label1.Caption, 1)
For i = 3 To Len(Label1.Caption) Step 2
c1 = Mid(Label1.Caption, i, 1)
If c1 < c Then c = c1
Next i
List1.AddItem "最小的字母是:"
List1.AddItem c
End Sub
Private Sub Form_Load()
Label1.Caption = ""
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询