Article
    C#
    ADO.Net
    .NET
    ASP.Net & Web Forms
    Custom Controls
    Web Development
    Exception Handling
    XML
    Database
    Security in .Net
    Testing
    Web Services
    Windows Services
    Windows Controls
    WCF
    AJAX
    WPF
    XAML
    Reporting
    Setup
    VB.Net
    LINQ
    JQuery
    SilverLight
    JavaScript
    HTML5
    Crystal Report
    Cloud Computing
    Share Point
    Visual C++
    MVC
    Android
    PHP
    Java
    HTML
    WordPress
    Joomla
    Products
    Drupal
    Windows Phone
    JSON
    LightSwitch
    iPhone/iPad
    Ruby on Rails
    IIS 7
    Windows 8
    CSS/CSS3
    Excel
    MS Access
    Shortcut Keys
    Visual SourceSafe
    Team Foundation Server
    API(s)
    Sencha-Touch
    Single Page App
    Bootstrap
Follow Us
Follow _MindStick_ on Twitter View MindStick Software's LinkedIn profile View MindStick Software's Facebook profile
Top Contributor
Advertisement
Advertise with Us
Mindstick
Article Article  Forum Forum  Blog Blog  Quiz Quiz  Beginner Beginner  Careers Careers  Contact Contact  Login Login  
Home | Product | Services | About Us | Interview | DeveloperSection | Submit an Article | Submit Blog

Home >> VB.Net >> ComboBox Control in VB.Net
ComboBox Control in VB.Net
ComboBox Control in VB.Net


by Pushpendra Singh on 12/13/2010 8:55:14 PM

Views: 5560       Comments: 0

ComboBox Control in VB.Net

ComboBox is a combination of a TextBox and a ListBox.

How use the ComboBox Control

Drag and drop ComboBox from toolbox on window Form.

 

ComboBox Control in VB.Net

Code:

'Here Item is added in combobox on form load

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load       

        ComboBox1.Items.Add("C#")'Add the First item in ComboBox

        ComboBox1.Items.Add("J#")

        ComboBox1.Items.Add("VB")

        ComboBox1.Items.Add("Java")

    End Sub

'Here show the selected item in Label2 on ComboBox SelectedIndexChanged event

 

    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged

        ' Assign the selected item in label

        Label2.Text = "You selected " + ComboBox1.SelectedItem

    End Sub

 

 

In above code Item is added dynamically so all Item in ComboBox1  will show at run time.

 

Run the project

 

ComboBox Control in VB.Net

When you select the given option then SelectedIndexChanged event will fire and selected item will show in the messagebox.

 

ComboBox Control in VB.Net

 

How set the AutoCompleteSource Properties

Choose AutoCompleteSource property of ComboBox is ListItem and also set AutoCompleteMode to suggest, append, or SuggestAppend.

ComboBox Control in VB.Net

When you type any text in the ComboBox then it searches the related item and if related item is available then it suggest the related item.

ComboBox Control in VB.Net

Report Abuse Form
Reason:    
 

Title :
Comment :
Text ColorBackground Color
BoldItalicUnderline
LeftCenterRightJustify
Ordered ListBulleted List
IndentOutdent
Horizontal Rule
SubscriptSuperscript
HyperlinkImage
Design ModeDesign
View HtmlHtml
     
 
Latest Article by Pushpendra SinghRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Latest BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Top Viewed ArticlesRSS Feed
    
    
    
    
    
    
    
    
    
    
Top Viewed BlogsRSS Feed
    
    
    
    
    
    
    
    
    
    
Latest Interview QuestionsRSS Feed
    
    
    
    
    
    
    
    
    
    
More...
Total Online Users: 5400
Advertisement
MindStick DataConver
Advertise with Us
  
Copyright © 2009 - 2014MindStick. All Rights Reserved.