ArrayList to ComboBox Items Collection using VB.Net

0
82

ArrayList to ComboBox Items Collection using VB.Net

ArrayList to ComboBox Items Collection using VB.Net.

In this tutorial, you will learn how to import your array list collection to your ComboBox Item Collection.

First, create your project and name it as you like.

Next, add a combobox in your blank Form1 designer and double click the Form1 itself.

After that, let’s create our own ArrayList and we will make it as our combobox’s data source for its item collection. Here’s the line of code:

  1. Public Class Form1
  2.  
  3. Dim items As New ArrayList
  4.  
  5. Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  6. items.Add("www.itsourcecode.com")
  7. items.Add("arraylist to combobox")
  8. items.Add("visual basic tutorial")
  9. ComboBox1.DataSource = items
  10. End Sub
  11.  
  12. End Class

After copying the line of code and paste it on your Form1 code canvass, here’s the output.

arraylist to combobox items in vb.net

As you can see, all the values that we have added on our ArrayList significantly shows to our combobox items.

Array list can be useful in many ways especially when you want to collect ordered object. Also, in each object inside the array list can be indexed individually.

For questions or any other concerns or thesis/capstone creation with documentation, you can contact me through the following:

E-Mail: [email protected]

Facebook: facebook.com/kirk.lavapiez

Contact No.: +639771069640

Ian Hero L. Lavapiez

BSIT Graduate, soon to be MIT.

System Analyst and Developer

Related topic(s) that you may like:

 

 

Facebook Comments
(Visited 90 times, 1 visits today)

LEAVE A REPLY

Please enter your comment!
Please enter your name here