1. *** New version of B4J is available ***
    B4J v7.8
    Dismiss Notice

Clearing a combobox's text area in code

Discussion in 'Questions (Windows Mobile)' started by Ricky D, Oct 2, 2008.

  1. Ricky D

    Ricky D Well-Known Member Licensed User

    I am wondering how do I clear the text part of a combobox on a form?

    It doesn't have a text property and setting SelectedIndex to -1 does nothing.

    regards, Ricky
  2. klaus

    klaus Expert Licensed User

  3. agraham

    agraham Expert Licensed User

    If you really need to you can use the Door library. obj1 is a Door library Object.

  4. JOTHA

    JOTHA Well-Known Member Licensed User

    ... another question ...

    In this case I have another question:

    Is it possible to add text to a combobox an save it?

    I mean on the PocketPC, not on the desktop.


    You have a combobox with 4 predefined words in it.


    Now you want to add No5, for example "Milk", and you want to save it to use it another time.

    Is this possible (and how)?

    THANKS if someone knows a solution.
  5. Ricky D

    Ricky D Well-Known Member Licensed User


    Thanks Agraham, that works just right :)

    Klaus: I need to have it clear when I add a new DailyTarget entry. The field has no default - I have designed it this way.

    Jotha: use the Add method of the combobox to add new items. If you store them in a database then you'll need to add a new record to it too. I'm using SqlLite as my database.
  6. klaus

    klaus Expert Licensed User

    Hello JOTHA,

    You can do it that way:
    - add a TextBox, where the user can input the new text.
    - add a Button, when clicking it, the program adds the new text in the Combobox.
    - save all the values and their number in aread this file at file when closing the program
    - read this file at the start of the program and initialize the ComboBox.

    I am using this way of dooing in this program http://www.basic4ppc.com/forum/share-your-creations/1316-expense-tracker.html in the Config panel.

    Best rgards.
  7. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Adding new items is simple enough, you just need to use ComboBox1.Add("value")
    If you want to save this for the next time the program is loaded then you need to store the values somewhere.
    This could be an ini file or the simplest method would be to use a table to store the values, saving and loading to a csv file.

  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