Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. Search in Combo

Search in Combo

Scheduled Pinned Locked Moved Visual Basic
csharphelptutoriallounge
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    msleem
    wrote on last edited by
    #1

    I use VB.NET 2005 and I want to search in combo's items . for example : the combo have many names when I start to write the first litter of the name which I want to find , the combo automatically find the names which begin with the same letter and show them in order. In VB6 I use this code : (General Diclaration) Global IgnoreTextChange As Boolean ' Public Function ComboSearch(CO As ComboBox) Dim I% Dim NewText$ If Not IgnoreTextChange And CO.ListCount > 0 Then For I = 0 To CO.ListCount - 1 NewText = CO.List(I) If InStr(1, NewText, CO.Text, 1) = 1 Then If Len(CO.Text) <> Len(NewText) Then IgnoreTextChange = True I = Len(CO.Text) CO.Text = CO.Text & Mid$(NewText, I + 1) CO.SelStart = I CO.SelLength = Len(Mid$(NewText, I + 1)) Exit For End If End If Next Else IgnoreTextChange = False End If End Function and thanks for any help :):):)

    soly

    T 1 Reply Last reply
    0
    • M msleem

      I use VB.NET 2005 and I want to search in combo's items . for example : the combo have many names when I start to write the first litter of the name which I want to find , the combo automatically find the names which begin with the same letter and show them in order. In VB6 I use this code : (General Diclaration) Global IgnoreTextChange As Boolean ' Public Function ComboSearch(CO As ComboBox) Dim I% Dim NewText$ If Not IgnoreTextChange And CO.ListCount > 0 Then For I = 0 To CO.ListCount - 1 NewText = CO.List(I) If InStr(1, NewText, CO.Text, 1) = 1 Then If Len(CO.Text) <> Len(NewText) Then IgnoreTextChange = True I = Len(CO.Text) CO.Text = CO.Text & Mid$(NewText, I + 1) CO.SelStart = I CO.SelLength = Len(Mid$(NewText, I + 1)) Exit For End If End If Next Else IgnoreTextChange = False End If End Function and thanks for any help :):):)

      soly

      T Offline
      T Offline
      The ANZAC
      wrote on last edited by
      #2

      try findstring on the text_changed event. Not Sure Exactly where to find it. maybe me.combobox1.findstring(me.combobox1.text), think that should do it. Should choose the closets matching item.

      Posted by The ANZAC

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups