Combo box in Visual Basic


The ComboBox is used to display a list incompact form.And so this control consume less space and still can have all the elements of list in it. List elements can be added both at design time and at run time.

1.Open Visual Basic 6.0 and create a new Standard EXE Project.

2.From Standard EXE project Dialogbox choose Standard EXE form.

3. Add one  Combo Box    and Command Button from toolbox on the form.

4.Change the caption of command button.

 

 

 

 

 

 

 

5.Then add code in code window.Following is an example to add item to a combo box. The code is typed in the Form_Load event.

 

 

 

 

 

 

 

6.Use the File menu to save your work as Main.frm and (your intitials)Project1.vbp

7.Use <f5> key to run the program.

Comments are closed.