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

listbox的BUG,该怎么处理

2012-02-17 
listbox的BUGPrivateSubCommand1_Click()DimdataAsStringDimfilenumAsLongOnErrorGoToerr1CommonDialog1.S

listbox的BUG
Private   Sub   Command1_Click()
Dim   data   As   String
Dim   filenum   As   Long
On   Error   GoTo   err1
CommonDialog1.ShowOpen
CommonDialog1.Filter   =   "*.*|*.txt "
Open   CommonDialog1.FileName   For   Input   As   #1
        List1.Refresh
  Do   While   Not   EOF(1)
        Line   Input   #1,   data
        List1.AddItem   data
  Loop
        Close   #1
err1:
    'MsgBox   "打开文件错误 "
    Exit   Sub
End   Sub

Private   Sub   Command2_Click()
Dim   i   As   Long
  f   =   Trim(InputBox( "请输入要找的数据 "))
  For   i   =   0   To   List1.ListCount   -   1
    If   StrComp(List1.List(i),   f)   =   0   Then
          List1.ListIndex   =   i
          Exit   For
    End   If
  Next   i
 
End   Sub
当数据载入到6万多行时,List1.ListCount没返回值了,谁帮试下是什么问题

[解决办法]
这个不算BUG啊
List1.ListCount,还有滚动条的Max,都有最大限制,65535
数据量大就不要用这个了,
执行六万多次additem,用户会等得头发都白了
[解决办法]
Property ListCount As Integer
这是listbox定义的属性

热点排行