0

can anyone help me how to programming the list box code in the VB6? i wan display the item i input in interface text field and combo box, then can display at the list box in that interface too.. pls provide the programming code for me.. thanks..

7
Contributors
11
Replies
21
Views
9 Years
Discussion Span
Last Post by Jx_Man
0

this for add item from selected item on combo box to listbox :

Private Sub Combo1_Click()
List1.AddItem (Combo1.Text)
End Sub

to add item from textbox to listbox you need button to execute all letters on textbox to listbox cause if u direct to add from textbox it will add one by one word in textbox.
or you can manage all input from textbox and combo box with one button :

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

In listbox, We Can add items both at Design time & Runtime.

Design time-
To add items to a losbox, click the List property and then add the items. press cTRL+Enter after adding each item

RUN Time--
object.addItem item,index

item argument represents the text to add to the list
Index argument indicates where in the list to add new item.

0

Hi Jx_Man, u can also select the item in the textbox from the listbox without having the button , SEE THE CODE BELOW & Second thing,text given by you to add item from the combobox to listbox is not working.

Hi CometBurn,
SEE The Code Below--
Private Sub List1_Click()
Text1.Text = List1.List(List1.ListIndex)
End Sub

0

Hi Sonia,

To select an Item in ListBox, Which is in Textbox , use :

List1.Text = Text1.Text

If text1.Text is found in the ListBox, That Item is selected/highlighted, or else, if not found then, No item in Listbox is selected..

Regards
Veena

0

Hi Jx_Man, u can also select the item in the textbox from the listbox without having the button , SEE THE CODE BELOW & Second thing,text given by you to add item from the combobox to listbox is not working.

Hi CometBurn,
SEE The Code Below--
Private Sub List1_Click()
Text1.Text = List1.List(List1.ListIndex)
End Sub

he want to manage it all in one event. so i suggest him to handle all with one button.
and you give a wrong code!!. he want to display input from textbox or combobox into listbox, and you give a code to display item into textbox which it selected on listbox.
Please read his question carefully.

i wan display the item i input in interface text field and combo box, then can display at the list box in that interface too

0

Hi Jx_Man, u can also select the item in the textbox from the listbox without having the button , SEE THE CODE BELOW & Second thing,text given by you to add item from the combobox to listbox is not working.

Hi CometBurn,
SEE The Code Below--
Private Sub List1_Click()
Text1.Text = List1.List(List1.ListIndex)
End Sub

Sonia...you give a wrong code friend...
actually i didn't get a point of dennis question, but i suggest he want to display an item which it input in textbox or combo box into listbox. so what u input in combo box or textbox will display in listbox.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.