How do I add items to a ComboBox and sort them?

The following code shows how to add items to a ComboBox.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ComboBox1.Items.Add(“India”)
ComboBox1.Items.Add(“Australia”)
ComboBox1.Items.Add(“Sweden”)
ComboBox1.Items.Add(“Spain”)
ComboBox1.Items.Add(“England”)
ComboBox1.Items.Add(“United States”)
ComboBox1.Items.Add(“Russia”)
ComboBox1.Items.Add(“China”)
ComboBox1.Items.Add(“Japan”)
ComboBox1.Items.Add(“New Zeland”)
End Sub


To sort the items alpahbetically, select the .Sorted property and set it to True.

Written by Sandeep Mogulla, Webmaster at www.startvbdotnet.com

Index

 
Printer friendly version of the FAQ-WinForm-VB-ComboBox-Control page


Sponsored links

Check For Updates
Easily add update features to your applications. A complete .Net updating solution.
Build IT Knowledge with Current & Trusted Content
Helps Employees Develop & Hone New Technical Programming Skills. Sign Up & Get Full Access.
Check Out IT Certification Preparation Materials
Sign Up With SkillSoft & Get Access to Training Materials for Over 50 Professional Certifications.
Villanova University Six Sigma & IT Certificate Programs
100% Online programs in Six Sigma, IS Security, CISSP Prep, Business Analysis, Proj. Mgmt. and more!
.Net Localization in three simple steps (WYSIWYG)
Localize .Net, C#/C/C++ & Delphi apps visually. HTML, HTML Help, XML & databases. Try Sisulizer now!

Advertisement



Free Magazine

Free Magazines
eWeek The essential technology information source for builders of e-business.... subscribe now

Newsletter | Submit Content | About | Advertising | Awards | Contact Us | Link to us |
© 1996-2008 Community Networks Ltd All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited. Violators of this policy may be subject to legal action. Please read Terms Of Use and Privacy Statement for more information. Development by Synchron Data - .NET development.