Closed Thread
Results 1 to 9 of 9

Thread: Disable typing in a combo box

  1. #1
    Chan is offline Programming Professional
    Join Date
    Jun 2006
    Posts
    205
    Rep Power
    0

    Disable typing in a combo box

    I don't want users typing into a combo box and I'd like it if they could only select from the list I apply. I'm not sure why you can't disable this feature properly but can someone tell me how its done?

    thanks

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    brackett is offline Programmer
    Join Date
    May 2006
    Posts
    192
    Rep Power
    22
    Sounds like you just want the plain ol' ListBox. A ComboBox does have different DropDownStyles though, which you may want to look at.

  4. #3
    Frantic's Avatar
    Frantic is offline Learning Programmer
    Join Date
    May 2006
    Posts
    91
    Rep Power
    0
    Just capture the keydown event and don't let them type. Very easy. ListBox doesn't look as good as a ComboBox.

  5. #4
    Jordan Guest
    In your onKeyDown method use e.Handled = True

  6. #5
    Chan is offline Programming Professional
    Join Date
    Jun 2006
    Posts
    205
    Rep Power
    0
    How do I add that method? Do I just type in KeyDown()?

  7. #6
    karthizen is offline Newbie
    Join Date
    Sep 2008
    Posts
    1
    Rep Power
    0

    Re: Disable typing in a combo box

    does any one knows how to disable editing in a combo box?

  8. #7
    Sumarak is offline Newbie
    Join Date
    Apr 2009
    Posts
    1
    Rep Power
    0

    Re: Disable typing in a combo box

    this is what i use... very easy

    --------------------------------------------------------------------------

    Private Sub ComboBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles ComboBox1.KeyDown

    e.SuppressKeyPress = True

    End Sub

    --------------------------------------------------------------------------
    vb 08

  9. #8
    Join Date
    Mar 2008
    Location
    The North Pole
    Posts
    13,174
    Blog Entries
    13
    Rep Power
    114

    Re: Disable typing in a combo box

    You don't need any code at all - just change the DropDownStyle property to DropDownList, instead of DropDown.

    Quote Originally Posted by Jordan View Post
    Good members, like yourself, stick around and post for ages to come!
    Mr. Xav | Blog | Forums

  10. #9
    norelad is offline Newbie
    Join Date
    Jun 2009
    Posts
    1
    Rep Power
    0

    Re: Disable typing in a combo box

    But if you want the user to be able to either only select from list or Delete then Dropdownlist is no good

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. hide letters while typing
    By delphiproblematic in forum Pascal and Delphi
    Replies: 5
    Last Post: 04-03-2010, 08:03 AM
  2. Elbow Typing - Hehe
    By Donovan in forum Games
    Replies: 20
    Last Post: 01-01-2009, 12:10 PM
  3. Typing injuries?
    By KeilanS in forum The Lounge
    Replies: 10
    Last Post: 11-25-2008, 10:17 AM
  4. Disable typing in combobox
    By Crane in forum Managed C++
    Replies: 4
    Last Post: 09-23-2008, 03:49 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts