高手快来!VB中listbox使用有关问题
高手快来救命啊!!!VB中listbox使用问题
我在form1里增加了一个listbox1控件,想往里面添加10个300以内的随机数
怎样实现,
当我使用ListBox1.AddItem的时候,VS2010中提示'AddItem' is not a member of 'System.Windows.Forms.ListBox'
怎么解决???
------解决方案--------------------
ListBox1.Items.Add
------解决方案--------------------
我在form1里增加了一个listbox1控件,想往里面添加10个300以内的随机数
怎样实现,
当我使用ListBox1.AddItem的时候,VS2010中提示'AddItem' is not a member of 'System.Windows.Forms.ListBox'
怎么解决???
------解决方案--------------------
ListBox1.Items.Add
------解决方案--------------------
- VB code
Dim i As Long ListBox1.Clear For i = 1 To 10 Randomize ListBox1.AddItem CStr(Int(300 * Rnd)) Next i
------解决方案--------------------
- VB code
Dim i As Long ListBox1.Items.Clear() For i = 1 To 10 Randomize() ListBox1.Items.Add(CStr(Int(300 * Rnd()))) Next i