Results 1 to 6 of 6

Thread: UniListBox, Unicode ListBox

  1. #1

    Thread Starter
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    UniListBox, Unicode ListBox

    Enjoy Please tell if you find odd behavior or bugs.


    Attached Images Attached Images  
    Attached Files Attached Files

  2. #2

    Thread Starter
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    Re: UniListBox, Unicode ListBox

    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).

  3. #3
    New Member
    Join Date
    Mar 2006
    Location
    Bangkok, Thailand
    Posts
    1

    Re: UniListBox, Unicode ListBox

    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?

  4. #4
    Junior Member
    Join Date
    May 2006
    Posts
    17

    Listbox - highlight selected?

    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:
    1. Private Sub Form_Load()
    2. With mrsEmp
    3.         Do Until .EOF
    4.             lstBoxEmployees.AddItem !szLast_nm & ", " & !sFirst_nm
    5.             lstBoxEmployees.ItemData(lstBoxEmployees.NewIndex) = !lEmp_id
    6.             .MoveNext
    7.         Loop
    8.         .MoveFirst
    9.         lstBoxEmployees.Text = !szLast_nm
    10. 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

  5. #5
    Junior Member
    Join Date
    May 2006
    Posts
    17

    Re: UniListBox, Unicode ListBox

    Never Mind...found it. Funny I did search everywhere else but here

    Found solution few minutes later. Thank VMWIRE.

    VB Code:
    1. lstBoxEmployees.Selected(0) = True

  6. #6
    Hyperactive Member
    Join Date
    Jan 2007
    Posts
    448

    Re: UniListBox, Unicode ListBox

    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?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width