Results 1 to 10 of 10

Thread: combobox

  1. #1

    Thread Starter
    Addicted Member smh's Avatar
    Join Date
    Oct 2000
    Location
    South Dakota, USA
    Posts
    249
    How can you lock a combo box so that the user can't delete the name that is shown, but can still select another name?

    If it was a textbox, I would lock it, but you can't do that with a combobox and then select another name from the list.
    Normal is boring...

    smh

  2. #2
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    Set the Style property to 2 - Dropdown List.
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  3. #3
    Guest
    Either just use a list box , or set the Style to 2 - drop down list

  4. #4

    Thread Starter
    Addicted Member smh's Avatar
    Join Date
    Oct 2000
    Location
    South Dakota, USA
    Posts
    249
    I can't do that because of the following code:

    rstOwner.Open "SELECT * from ATMOwnerContacts where OwnerName='" & cboOwner.Text & "';", cnn

    cboOwnerContact.Text = rstOwner!contact
    txtPhoneNumber = rstOwner!Phone
    txtExtension = rstOwner!extension & ""
    txtFaxNumber = rstOwner!fax
    txtEmail = rstOwner!Email

    I get the error 'Read Only'.
    Normal is boring...

    smh

  5. #5
    Guest
    Try this:


    Code:
    Private Sub Combo1_KeyPress(KeyAscii As Integer)
        KeyAscii = 0
    End Sub

  6. #6

    Thread Starter
    Addicted Member smh's Avatar
    Join Date
    Oct 2000
    Location
    South Dakota, USA
    Posts
    249
    That worked great with one exception.

    What if they highlight the word and then press delete? It does delete then.

    Any suggestions on how to prevent that?
    Normal is boring...

    smh

  7. #7
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    Try this smh....

    Code:
    Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
        KeyCode = 0
    End Sub
    
    Private Sub Combo1_KeyPress(KeyAscii As Integer)
        KeyAscii = 0
    End Sub
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  8. #8

    Thread Starter
    Addicted Member smh's Avatar
    Join Date
    Oct 2000
    Location
    South Dakota, USA
    Posts
    249
    Thanks guys...it works great!
    Normal is boring...

    smh

  9. #9
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    Found another problem smh, if the user highlights the text and presses the space bar the text can still be deleted.
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

  10. #10
    Fanatic Member
    Join Date
    Sep 1999
    Location
    Bethel, North Carolina, USA
    Posts
    987
    Nevermind I did something stupid!!
    {Insert random techno-babble here}

    {Insert quote from some long gone mofo here}

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