首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

列表框中怎么增加时重复的值不增加

2012-01-03 
列表框中如何增加时重复的值不增加?我在窗体中加了一个组合框,将当前机上的字体加到组合框中,但发现有重复

列表框中如何增加时重复的值不增加?
我在窗体中加了一个组合框,将当前机上的字体加到组合框中,但发现有重复的字体,是什么原因?如何能消除重复的字体?


[解决办法]
Private Sub Command1_Click()
On Error Resume Next
Dim mCollection As New Collection
Dim i As Long
For i = 0 To Screen.FontCount - 1
mCollection.Add Screen.Fonts(i)
Next

For i = 0 To Printer.FontCount - 1
mCollection.Add Printer.Fonts(i)
Next

For i = 1 To mCollection.Count
Combo1.AddItem mCollection.Item(i)
Next
Set mCollection = Nothing
End Sub

热点排行