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..

what do you want to do?

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

could you explain it on a clear way?

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.

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

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

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

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.

badey-badey desho mai aisi choti-2 batei hoti rahti hai..

what r u talking about ruchika beddy???

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.