VBCE.com - The Premier Website For Visual Basic/CE Developers

 

*Dev Corner

Sample Code
Controls
Workarounds
Tips & Tricks
Q & A
Forums

*Goodies
Downloads
Software
Bookstore


*General
Home
What's New
General Info
Misc. Info


*News Worthy
News
Articles
Editorials
KB Articles
Reviews
Awards

*Miscellaneous
Web Links
Partners
Search
Feedback
Advertising

<% On Error Resume Next SiteStats() %>

Sponsors


More...


Prevent ListBox Dbl-Click Errors
By mike@vbce.com

    There's a bug (Q180833) in the VBCE ListBox control that allows the Double Click event to fire when there are no items in the ListBox. Normally in VB, the Double Click event does not fire if there are no items in the ListBox. Normally, it is safe to assume that there will be a valid (greater than -1) ListIndex value of the ListBox while in the Double Click event.

    To prevent application errors, you should add the following check to the DoubleClick event if you are going to be doing anything in the DoubleClick event:

Private Sub List1_DblClick()
  If List1.ListIndex = -1 Then Exit Sub
  List1.RemoveItem List1.ListIndex

End Sub

bug_word.jpg (1504 bytes)
bug_ant_1.gif (13248 bytes)
workaround.jpg (2931 bytes)

 

“When the bugs get tough,
the tough get coding!”



VBCE.com is DevX Winner!

Unless otherwise noted, all information on VBCE.com is Copyright 1998 - 2002
Windows, Windows CE, and Visual Basic are trademarks of the Microsoft Corporation.
VBCE.com is not responsible for content on external sites.
Send all feedback to webmaster@vbce.com
Webmasters - feel free to link to
VBCE.com - Premier Website for Visual Basic/CE Development

Buy Books!