Walk Lightly on this PLANET and yet leave such a FOOTPRINT that cannot be erased for thousands of Years..!!!
Visit Codstech for Cyber Security related Posts !

Visitors

Sunday, June 5, 2011

VB-20 : Removing items in a listbox/Combobox (Through Program)

Removing items in a listbox/Combobox (Through Program)




(A)        When we click the Remove button, the added items will remove from the list/combo box starting from 0th position.
(If we want to remove items as per our choice, then refer the next program)




     A)   Property :
ComboBox : NAME- Combo1,TEXT-(Blank)
Textbox : NAME-Text1,Text- (Blank)
CommandButton-NAME- Command1,Caption-Add
CommandButton-NAME- Command2,Caption-Remove



 B)   Attaching Code to the Object :

Private Sub Command1_Click()
Combo1.AddItem Text1.Text
End Sub

Private Sub Command2_Click()
Combo1.RemoveItem 0
End Sub



Note : Combo1.RemoveItem 0 èè The items in the list/combo box are stored as index,starting from 0,1,2,3…….etc.

That is,first item is in 0th position , second item is in 1st position etc.

========================================================================
(B)        If we want to remove items as per our choice from the list/combo box, then follow the below given steps..

(It’s your Homework :)) )
========================================================================



Back to Home   &  VB

No comments: