ComboBox Value

Discussion in 'Basic4ppc Wishlist' started by RandomCoder, May 29, 2007.

  1. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Hi Erel,

    I have a form with several fields, some of these fields use ComboBox's to limit the choice to the user. I would like to be able to get the value from each ComboBox and the rest of the controls when the user clicks the finish button.

    At present there appears to be two methods of doing this...
    1) Use the SelectionChanged event on each ComboBox to obtain and store the value/text in a Global variable until the finish button is pressed.
    2) On pressing the finish button, look at the SelectedIndex property for each ComboBox and then use a Select Case to determine what the actual value/text is.
    Neither is particularly pretty.

    It would be far better for me if I could just look at the value/text that has been selected when the finish button is pressed. Something like...


    Is it possible to include a text property?? Maybe in the next version??

  2. BjornF

    BjornF Active Member Licensed User

    I don't understand, why do you need the "select case" (in your alternative 2)?

    Doesn't this give the text from the combobox:

    (It does for me :) )
  3. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Thanks BjornF,

    That's exactly what I was after :sign0060: (albiet a slight workaround)

    I was using...


    which just returns the position of the chosen item :sign0161:

  4. Vito

    Vito Member Licensed User


    I have used:


    it works...!

  5. specci48

    specci48 Well-Known Member Licensed User

    A combobox has is no official .text property.
    Is it a bug or an "undocumented feature" :confused:

    I think it shouldn't be used because it may not be supported in future versions of basic4ppc.

  6. Erel

    Erel Administrator Staff Member Licensed User

    The problem with ComboBox.Text is that on the desktop the user can write in the combobox and it will return the text that the user wrote.
    The write syntax is: ComboBox.Item(ComboBox.SelectedItem)
  7. rbw152

    rbw152 Member Licensed User

    Combo Text


    actually this 'bug' is exactly what I want so don't 'fix' it please!

    Here's the scenario: the user is selecting items (electrical device types) from a combo as they scan barcodes on the objects.

    If an object type does not exist they need the ability to add it in the combo by typing it in - which the combobox allows you to do. Then I need to save that back to the lookup table so it's there next time, something which would be impossible if you couldn't access the combobox.text property!

    Q. Why allow the user to type free-text into the combo if you then cannot access that text? Surely it should be locked to stop this if the text property is not supposed to be used?

    Anyway, it's fine as it is, leave it alone please! :)
  8. klaus

    klaus Expert Licensed User

    It is possible to change this behaviour with the Door library.
    The code below alows entry of text.

    You must load the Door library and define an object called obj1.
    Best regards.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice