VB.NET : AutoComplete textbox .-VBForums
Results 1 to 7 of 7

Thread: VB.NET : AutoComplete textbox .

  1. #1

    Thread Starter
    Elite Member
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,081

    VB.NET : AutoComplete textbox .

    VB.NET 2003 Proj .
    Attached Files Attached Files

  2. #2
    Addicted Member Codehammer's Avatar
    Join Date
    Aug 2004
    Posts
    164

    Exclamation Re: VB.NET : AutoComplete textbox .

    Please Submit this as a .zip, for Some Stuffed Up reason .Rar is Blocked!
    Curiosity SKILLED the cat
    Google Talk from your Mobile phone

    Chat from your mobile or get an emulator like J2ME Wireless Toolkit 2.2

  3. #3
    Member digioz's Avatar
    Join Date
    Oct 2005
    Location
    Chicago, IL
    Posts
    33

    Re: VB.NET : AutoComplete textbox .

    Here is the same thing in zip format. Great code by the way.
    Attached Files Attached Files
    Last edited by Hack; Jan 13th, 2006 at 09:07 AM.
    DigiOz Multimedia
    http://www.digioz.com

  4. #4
    New Member
    Join Date
    May 2006
    Posts
    2

    Talking Re: VB.NET : AutoComplete textbox .

    Hi im Paul,
    im from Brasil and im searching something about it, and searching in google i found this forum, so i post this reply to say that u dont need use API.

    U can use :
    ListBox1.SelectedIndex = (ListBox1.FindString(TextBox1.Text))





    by

    [Seven Software - http://7soft.info]

  5. #5
    New Member
    Join Date
    Jul 2006
    Location
    Canada
    Posts
    3

    Re: VB.NET : AutoComplete textbox .

    Try this... Drop a listview and a textbox on a form, then put this code in:

    Public Class Form1

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
    ListView1.SelectedItems.Clear()
    For ix As Integer = 0 To ListView1.Items.Count - 1
    Dim ls As String = ListView1.Items(ix).Text
    If String.Compare(ls.Substring(0, TextBox1.Text.Length), TextBox1.Text, True) = 0 Then
    ListView1.Items(ix).Selected = True
    ListView1.Items(ix).EnsureVisible()
    Exit For
    End If
    Next ix
    End Sub

    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    With ListView1
    .Columns.Add("Abadaba", 70)
    .View = View.Details
    .HideSelection = False
    .Items.Add("ABC")
    .Items.Add("ABD")
    .Items.Add("ACD")
    .Items.Add("BCD")
    .Items.Add("BDE")
    End With
    End Sub
    End Class

  6. #6
    New Member
    Join Date
    Nov 2006
    Posts
    2

    Re: VB.NET : AutoComplete textbox .

    This is fantastic, I was wondering though how I could add a value??? so that when you select the item, an id would be set to run in an SQL query???? i have this working with a listbox, but i would like to add this with the list view??????

  7. #7
    New Member
    Join Date
    Nov 2006
    Posts
    2

    Thumbs up Re: VB.NET : AutoComplete textbox .

    [Highlight=VB] Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    ' Populates the list box using DataSource.
    ' DisplayMember is used to display just the long name of each state.

    Dim USStates As New ArrayList()
    USStates.Add(New USState("Alabama", "AL"))
    USStates.Add(New USState("Washington", "WA"))
    USStates.Add(New USState("West Virginia", "WV"))
    USStates.Add(New USState("Wisconsin", "WI"))
    USStates.Add(New USState("Wyoming", "WY"))
    AddHandler ListBox1.SelectedValueChanged, AddressOf ListBox1_SelectedValueChanged
    ListBox1.DataSource = USStates
    ListBox1.DisplayMember = "LongName"
    ListBox1.ValueMember = "ShortName"
    end sub


    Private Sub ListBox1_SelectedValueChanged(ByVal sender As Object, ByVal e As EventArgs)
    If ListBox1.SelectedIndex <> -1 Then
    TextBox3.Text = ListBox1.SelectedValue.ToString()
    End If
    End Sub 'ListBox1_SelectedValueChanged

    This is what I have but need to add this to the listview, but the selected value isn't available. I'm trying to avoid an array with the values set, and using the selected index .....

    Figured it out, I used the keypress property, ahehaeahe
    Last edited by ookied; Nov 18th, 2006 at 07:02 PM.

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.