add items to combo box

To add items to ComboBox control you need to use the Add(object item) of the Items collection property of the ComboBox class. The following example code shows you how to add items to ComboBox control.
Public Class Form1

   Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
     Dim i As Integer = 0
     While i < 10
        ComboBox1.Items.Add(i) 'add items to combobox
        i += 1

     End While
     ComboBox1.Text = 0 'show 0 in the box when the combobox displays


    
   End Sub
End Class

Posted by: Lavy | post date: 02-10-2013 | Subject: VB.NET Programming Language




This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.