Results 1 to 4 of 4

Thread: combobox

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    320

    combobox

    I have a combobox. I want to select the item in the combobox when the text is entered (not matching just the first letter) and
    the user presses enter key. Please suggest!

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    are you talking about finding the exact string and selecting it then? if so...
    VB Code:
    1. [Color=Blue]Private[/COLOR] [Color=Blue]Sub[/COLOR] ComboBox1_KeyUp([Color=Blue]ByVal[/COLOR] sender [Color=Blue]As[/COLOR] [Color=Blue]Object[/COLOR], [Color=Blue]ByVal[/COLOR] e [Color=Blue]As[/COLOR] System.Windows.Forms.KeyEventArgs) [Color=Blue]Handles[/COLOR] ComboBox1.KeyUp
    2.         [Color=Blue]If[/COLOR] e.KeyValue = Keys.Enter [Color=Blue]Then
    3. [/COLOR]            [Color=Blue]Dim[/COLOR] x [Color=Blue]As[/COLOR] [Color=Blue]Integer[/COLOR] = ComboBox1.FindStringExact(ComboBox1.Text)
    4.             ComboBox1.SelectedIndex = x
    5.         [Color=Blue]End[/COLOR] [Color=Blue]If
    6. [/COLOR]    [Color=Blue]End[/COLOR] [Color=Blue]Sub[/COLOR]
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Posts
    320
    thanks works great, but I would rather replace FindStringExact with FindString

  4. #4
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    you can use FindString also to find the whole word ( but also to find the string by it's first character / characters )
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

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