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:
Public Class Form1 Dim items As New ArrayList Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load items.Add("www.itsourcecode.com") items.Add("arraylist to combobox") items.Add("visual basic tutorial") ComboBox1.DataSource = items End Sub End Class
After copying the line of code and paste it on your Form1 code canvass, here’s the output.
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:
- Clearing Text Controls using VB.Net For Loop Statement
- Transferring Multiple Data from DataGridView Rows to mySQL Database