CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2015
    Posts
    8

    Combo box Question

    I have a combo box I populate from an array, but what I'd like to do, is to have the user be able to modify the data in the combo box, then compare it to the old string from the array, and if the string has changed, then use the new string from the combo box. I can do this perfectly with a text box, but I'm not too familiar with all of the combo box's properties.
    I hope I'm making sense...

    The problem is the new string entered into the combo box is not recognized, by the ".list" property.

    Code:
    Do Until Mid(InsertArray(i), 1, 2) <> "H0"
    
    If MAIN_WIRE_SHAPE.Combo1.List(i) <> OffsetsNewArray(i) Then
    InsertArray(i) = Replace(InsertArray(i), InsertArray(i), MAIN_WIRE_SHAPE.Combo1.List(i))
    End If
    i = i + 1
    
    Loop

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Combo box Question

    Well, I'm not sure what you are doing but it sounds like you are typing into the combo box and then looking for the typed entry in the list and of course it will not be there unless you write some code to add it to the list.

    A combo box functions as a textbox and as a list box hence the combo.
    If you allow the user to type into the combo something that is not in the list then you must add it to the list through code if you want it to appear in the list. using the .additem method.

    If you just need to test what the user typed then you can use the text property of the combo box rather than the list(x) property
    Always use [code][/code] tags when posting code.

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

Featured