Results 1 to 3 of 3

Thread: select row in combobox

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    11

    Question

    My code is currently written to select or highlight the first row in a combobox. For example:

    cboExample.ListIndex = 0

    I need it to select or highlight the row that applies to the selected ID. If I write code to try to select a different row, I get an error. Here's an example:

    cboExample.ListIndex = i

    What is the best practice for specifying a row in a single-select combobox when you know what ItemData to look for??

    Thanks...

    TM

  2. #2
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Do I get you right or...

    ...am I brabbling bullshit

    You want to select a specific Item in a ComboBox?
    you could just use this:


    Code:
    Combo1.AddItem "Jop"
    Combo1.AddItem "TragAnn"
    Combo1.Text = Combo1.List(1)
    But I'm not quite sure if that's what you mean. Anyway, let me know (please)

    BTW, this code works to but be sure to give i a number:
    Code:
    Dim i As Integer
    i = 1
    Combo1.AddItem "Jop"
    Combo1.AddItem "TragAnn"
    Combo1.ListIndex = i
    That's what you needed?

    [Edited by Jop on 09-07-2000 at 10:40 AM]
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    11

    Talking Yep

    Jop - Yes...thanks for the help. I was over-complicating the issue, plus I found some erroneous code below the piece I was working with that was resetting the ListIndex back to 0. Not good. Cleaned that up and works like a champ.

    Peace.
    TM

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