Forums  

Go Back   Forums > The .NET Framework > VB.NET

Top Posters
Last Post: 5 Hours Ago
Post Count: 28,521
Last Post: 07-18-2010
Post Count: 405
Last Post: 03-22-2010
Post Count: 122
Last Post: 03-13-2010
Post Count: 35
Last Post: 03-20-2010
Post Count: 35
More...
Mini Stats
Members 513 Entries 0
Members Entries
Threads 38,537 Reviews 0
Threads Reviews
Posts 38,646 Polls 5
Posts Polls
Content 3 Files 0
Content Files
Links 0 Ads 0
Links Ads
More...
  #1  
Old 03-27-2010
TheDude's Avatar
TheDude TheDude is offline
Administrator
 
Join Date: Dec 2002
Location: Behind the PC
Posts: 405
Auto Completing a combo box

ComboBox1.AutoCompleteSource = AutoCompleteSource.ListItems

You can do this through the Properties window for the Combobox too. I used code to make the point more clear. Here's the complete source code that you could plug into the Load event subroutine for a Form.

Code:
   Dim Mary As New List(Of String)
   Dim Words() As String = New String() _
       {"Mary", "Had", "A", "Little", _
       "Lamb.", "It's", "Fleece", _
       "Was", "White", "As", "Snow."}
   Mary.AddRange(Words)
   Mary.Sort()
   ComboBox1.Items.AddRange(Mary.ToArray)
   ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList
   ComboBox1.AutoCompleteSource = AutoCompleteSource.ListItems
   ComboBox1.SelectedIndex = 0
__________________
Thanks
Admin
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -4. The time now is 07:19 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.