Results 1 to 10 of 10

Thread: Combobox Change Event Question

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    Combobox Change Event Question

    Why won't this code work? It doesn't change to the correct directory, clear the listview, & repopulate the listview on the change event. Here's my code:
    VB Code:
    1. Private Sub Combo1_Change()
    2. File1.Path = "C:\mp3s\" & Combo1.Text
    3.  ListView1.ListItems.Clear
    4.  For X = 0 To File1.ListCount - 1
    5.        
    6.         Set i = ListView1.ListItems.Add(, , File1.List(X))
    7.         i.SubItems(1) = File1.Path
    8.     DoEvents
    9.    
    10.     Next
    11. End Sub

  2. #2
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429
    Combo1 Change Event won't fire if u have selected an Item from
    the drop down list...

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    so how to fix?

    How can I fix this then? It seems to work with a drivelistbox

  4. #4
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429
    Unfortunatly its a limitation of the ComboBox....
    (I'm having the same problem - Any one know a way around it)

    I'm temp using Combo_LostFocus/Validate to check for
    changed data.

  5. #5
    Addicted Member
    Join Date
    Oct 2001
    Location
    Bangalore ,India
    Posts
    240

    COMBO BOX CHANGE EVENT

    i think yu can go for the combo click event ,
    change event does not work : a draw back .
    well, one simple solution is that yu can check with the click event of the combo .
    senthil

  6. #6

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2001
    Location
    Maumelle, AR
    Posts
    624

    Click Event Works!

    I put the same code on the click event & it works fine. That is REALLY stupid though. What is the point of even having the Change event then? Oh well.

  7. #7
    Frenzied Member ae_jester's Avatar
    Join Date
    Jun 2001
    Location
    Kitchener Ontario Canada Earth
    Posts
    1,545
    I always use the MS Forms Combo Box instead of the default VB combo box and I never have this problem. The MS Forms Combo Box allows you to use columns that work real nicely also. Thats why i use it.

  8. #8
    New Member
    Join Date
    May 2002
    Posts
    1

    combo box

    "I put the same code on the click event & it works fine. That is REALLY stupid though. What is the point of even having the Change event then? Oh well."

    Because change does not mean.. change as in you changed the selection, change means typing in a value as you can add items
    to combo boxes. etc

    Click is what you want for this, as click is "clicking" to select
    another list item.

  9. #9
    Addicted Member
    Join Date
    Oct 2001
    Location
    Bangalore ,India
    Posts
    240
    yes in combo box, the change is not working , i dont know whether if there is any other round about way to go for change event in combo-box.
    ,,,,
    senthil

  10. #10
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429
    I don't think there is a fault with the ListBox's Events.

    You just have to use the one that best suits your requirment.

    List1_Change has its place; it'll fire if the User 'changes' the Text by Typing in, or Cut n paste.

    whereas, List1_Click fires when a selection has been made.

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