Enjoy :) Please tell if you find odd behavior or bugs.
http://www.vbforums.com/attachment.p...id=42407&stc=1
Printable View
Enjoy :) Please tell if you find odd behavior or bugs.
http://www.vbforums.com/attachment.p...id=42407&stc=1
A bug found. Easy to fix: goto UserControl_Terminate and add SubClass.Unsubclass before the Set SubClass = Nothing. This fixes a bug that causes rare crashes (maybe one for every hundred runs or so).
Your code was missing TopIndex property. It can be added easily as
Public Property Get TopIndex() As Long
TopIndex = SendMessage(lst.hWnd, LB_GETTOPINDEX, 0&, ByVal 0&)
End Property
Public Property Let TopIndex(ByVal NewIndex As Long)
SendMessage lst.hWnd, LB_SETTOPINDEX, NewIndex, ByVal 0&
End Property
However, there are 2 problems that I found:
1. When setting ListIndex, the line is not highlighted.
2. The vertical line spacing does not match that of a standard listbox; it is smaller by a couple of pixels, meaning that side-by-side listboxes are misaligned.
Suggestions on how to fix these problems?
Done search of how to make, force...whatever. The listbox on form to highlight the first item listed in the listbox when the form loads. I have issue nothing i try works. I would assume by default it should do it on its own, but obviously not.
btw this is on a unbound form.
Here is code:
VB Code:
Private Sub Form_Load() With mrsEmp Do Until .EOF lstBoxEmployees.AddItem !szLast_nm & ", " & !sFirst_nm lstBoxEmployees.ItemData(lstBoxEmployees.NewIndex) = !lEmp_id .MoveNext Loop .MoveFirst lstBoxEmployees.Text = !szLast_nm End With
This is part of code it basically loads data from database into the listbox on the load event of the form. This works perfect no problems all data there and it shows the first item data on rist of form but in the listbox its not highlighted. I need it highlighted on load.?
anyone know how to do this?
any help much appreciated:)
Never Mind...found it. Funny I did search everywhere else but here :)
Found solution few minutes later. Thank VMWIRE.
VB Code:
lstBoxEmployees.Selected(0) = True
I know this thread is very old, but I downloaded the zip, registered the library and when running the program, ran into an unsupported property, "UpdateMode". So I went into the code and found that the property was definitely defined, but for some reason, the program does not see it. Any ideas as to why this would be happening?