用VB语言编写完成如下功能的程序,程序界面如下图所示。

2024-11-27 20:23:51
推荐回答(1个)
回答(1):

Private Sub Command1_Click()
If Option1.Value = True Then
For i = 1 To 10
List1.AddItem Int((80 - 50 + 1) * Rnd + 50)
Next
End If
If Option2.Value = True Then
If Dir("d:\test") = "" Then MkDir "d:\test"
Open "D:\test\test2.txt" For Output As #1
For i = 0 To List1.ListCount - 1
Print #1, List1.List(i)
Next
Close #1

End If
If Option3.Value = True Then
List1.Clear
End If
End Sub
listbox 排序是只读属性,需要提前设置,无法通过代码改变,如果要排序,只能用代码~