How To Add Items ComboBox in VB 6

download (2)In Visual Basic 6 there are many object can we use to developt program that we want to built. One of it is combobox, combobox is object that provide data as list when we click the data that we set will be show and we choose one data of much data in the list for process in the future.

So how the wat to set data in the object of combobox? Its will become the main question for us. There are 2 ways to set data in the object of combobox, here are:

First ways

  1. After you pairs the combobox on the form, move to code area and choose event that you want the data will be set, usually set data in the object set when form loaded.
  2. After that to add item you just code like this :

box.AddItem item[, index]

Note:

Box is Name of combobox that you pairs in your form

AddItem is function of this object to add item

item[, index] is name would appear in the list

 

for example :

Private Sub Form_Load ()

Combo1.AddItem "Muhamad"

Combo1.AddItem "Ade"

Combo1.AddItem "Lukmanul"

Combo1.AddItem "Hakim"

End Sub

 

Second ways

  1. If we dont want spend effort to write code, we can use the properties GUI to add item to the combobox, choose the object of combobox
  2. Looking up to properties area, usually in the right side of vb6. And search the List attribute. Like in the imagelist
  3. After that you just click that atribut and type the data want you add, enter to make sure the data entered
Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s