ARTICLE

Adding items to a ListBox control

Posted by Mahesh Chand Articles | Visual Basic 2010 June 24, 2003
This article shows you how to add items to a ListBox control.
 
Reader Level:

Ok, adding items to a listbox control is easy. You use Add method of the control. The following code shows you how to do so.

Drag a ListBox control on a form and use the following code to add items to the control.


Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim str As String = "First item"
Dim i As Integer = 23
Dim flt As Single = 34.98F
listBox1.Items.Add(str)
listBox1.Items.Add(i.ToString())
listBox1.Items.Add(flt.ToString())
listBox1.Items.Add("Last Item in the List Box")
End Sub 'Form1_Load

share this article :
post comment
 

Selection formula for listbox. hear i have a list of items in list box. I need to get report using that list box items. Iteams contains on numbers

Posted by sandeep parcha Mar 05, 2011
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
    ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications. Visit DynamicPDF here
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor