Results 1 to 7 of 7

Thread: Combobox properties got me confused

  1. #1

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Posts
    89

    Post

    Hi all,

    I have combo boxes which are populated with dynamic sql from sql 7.0. I want to have the combo box style as read only so that the user cant write in a value that is not present. The problem is that I have a grid, when the user click the grid it will populate the text part of the combo box with the users choice then go out to sql and retrieve the values for the combo box. I am unable to populate the text portion because it is read only. I guess after all this typing is how can i make the combo box read the grid but be locked if anything is typed inside of it.

    thanks

    Scott

  2. #2
    Lively Member
    Join Date
    Jan 1999
    Posts
    82

    Post

    Hi,

    Try unlocking it before you write from the grid, then relock right after.

    combobox.locked=false
    combobox.text=gridvalue
    combobox.locked=true

    Hope this helps,

    Preeti

  3. #3

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Posts
    89

    Post

    If you lock it then the combo is locked-it cant be changed at all, the dropdown wont work.

  4. #4
    Lively Member
    Join Date
    Jan 1999
    Posts
    82

    Post

    Hi,

    Okay, now I see what you are trying to do.

    Why don't you add the item to your combobox, then select that item through code:

    Combobox.AddItem gridvalue
    Combobox.ListIndex = Combobox.ListCount - 1

    the second line will place in the text part of the combobox the last item that was entered into the combobox.

    Hope this helps,

    Preeti

  5. #5

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Posts
    89

    Post

    That works the only problem is that when i populate the combobox from the server and get items
    1
    2
    3

    if i add the item lets say 1
    then my combobox looks like this
    1
    2
    3
    1

    if i try to delete it afterwords then the textbox portion becomes blank.

  6. #6
    Lively Member
    Join Date
    Jan 1999
    Posts
    82

    Post

    How are you making the combo boxes read only now?

    Whatever property you are setting, at
    run-time, reset the property to read and write, then write in the value from the grid, then reset your combo box back to read-only.

    Or is your question how to make a combo box read only?

    Preeti

  7. #7

    Thread Starter
    Lively Member
    Join Date
    May 1999
    Posts
    89

    Post

    at first i set the property in the settings, but then i wanted to do in code.
    u can choose dropdown combo
    simple combo or dropdown list

    but i decided to try the code

    combobox.style=2

    only problem if i try to change it from read to write, i get warning messages.

    basically i just want the user to only be able to choose values from the combo box, not write their own in.



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