Results 1 to 2 of 2

Thread: Setting text property on Combobox

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Nov 2000
    Posts
    17
    I know this question has been asked before, but it has never really been answered.

    I am using a combobox as a type 2, dropdown combo. I am trying to place a prompting text in the text field of the combobox: i.e. "Select Country" for a country selection dropdown.

    I can't simply set the text property because it's read-only. I will not set the type to 0 unless there is a way to prevent users from adding any text they want.

    I am hoping that there is an API (Probably the ubiquitous "SendMessage") or some trick.

    Thanks for any help.

    trapper

  2. #2
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    Don't know how to do exactely what you want, but give this a try:

    Code:
    Private Sub Combo1_DropDown()
    If Combo1.List(0) = "Please select a number" Then Combo1.RemoveItem 0
    End Sub
    
    Private Sub Form_Load()
    Dim x%
    Combo1.AddItem "Please select a number"
    For x = 0 To 40
    Combo1.AddItem x
    Next x
    Combo1.ListIndex = 0
    End Sub
    Jop - validweb.nl

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

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