Results 1 to 5 of 5

Thread: combo box in VB .net

  1. #1

    Thread Starter
    Lively Member sameer spitfire's Avatar
    Join Date
    Nov 2001
    Location
    India
    Posts
    120

    combo box in VB .net

    I was using Combo box in VB 6 which supports IncrementalSearch But in VB net I does not
    please help me how to go about it

    !!IncrementalSearch ?


    An example of an incremental search is if you are searching for the word "ELASTIC," you can type E-L-A, and so on. As you type, it incrementally searches for the combination of letters you have typed to match the word you are looking for and rest on the closest match
    with Regards
    sameer Mulgaonkar

  2. #2
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    here's a quick example i knocked up for you to get you started ...
    VB Code:
    1. '/// assuming you have a Combobox called " ComboBox1 " on your Form...
    2.     Private searcher As String = String.Empty
    3.  
    4.     Private Sub ComboBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles ComboBox1.KeyPress
    5.  
    6.         If Not e.KeyChar = Convert.ToChar(Keys.Back) Then
    7.             searcher += e.KeyChar.ToString
    8.             If Not ComboBox1.FindString(searcher) = -1 Then
    9.                 With ComboBox1
    10.                     .SelectedIndex = .FindString(searcher)
    11.                     .SelectionStart = searcher.Length
    12.                     .SelectionLength = .Text.Length - searcher.Length
    13.                 End With
    14.             End If
    15.         Else
    16.             ComboBox1.Text = ""
    17.             searcher = ""
    18.         End If
    19.     End Sub
    20.  
    21.     Private Sub ComboBox1_Validated(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.Validated
    22.         searcher = ""
    23.     End Sub
    ~
    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
    Frenzied Member EyeTalion's Avatar
    Join Date
    Jul 2000
    Location
    New York
    Posts
    1,075
    thanks Dynamic...that code works great.
    It's tough being an unhandled exception...

    ___________
    VB.NET 2008
    VB.NET 2010
    ORACLE 11g
    CRYSTAL 11

  4. #4

    Thread Starter
    Lively Member sameer spitfire's Avatar
    Join Date
    Nov 2001
    Location
    India
    Posts
    120
    which type of combo box style are u using ?

    Dropdown
    Dropdownlist


    I have done the same in Dropdownlist i works

    but my problem is the combo box auto Search also get fire

    when i Type W-i-

    The cursor frist move to W then moves to i and then rest on to wi

    than works but does not look good

    I want the inbuild auto search of combo box not to be fired

    How to go about it
    with Regards
    sameer Mulgaonkar

  5. #5

    Thread Starter
    Lively Member sameer spitfire's Avatar
    Join Date
    Nov 2001
    Location
    India
    Posts
    120
    which type of combo box style are u using ?

    Dropdown
    Dropdownlist


    I have done the same in Dropdownlist i works

    but my problem is the combo box auto Search also get fire

    when i Type W-i-

    The cursor frist move to W then moves to i and then rest on to wi

    than works but does not look good

    I want the inbuild auto search of combo box not to be fired

    How to go about it
    with Regards
    sameer Mulgaonkar

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