Saturday 8 December 2012

programatically add listbox items in visual Basic.NET


programatically add listbox items in visual Basic.NET

Create ListBox object add items to it, finally add it Controls list,

 Dim box As ListBox =  New ListBox()
            box.Width= 100
            box.Height=100
            box.Items.Add("Jan")
            box.Items.Add("Feb")
            box.Items.Add("Mar")
            box.Items.Add("Apr")
            box.Items.Add("Jun")
            box.Items.Add("Jul")
            box.Items.Add("Aug")
            box.Items.Add("Sep")
            box.Items.Add("Oct")
            box.Items.Add("Nov")
            box.Items.Add("Dec")

            Me.Controls.Add(box)

No comments:

Post a Comment