vb: how to replace listbox item?
Website Design
Website Promotion
Graphic Design
Programming
Free Software
Computer Tips
Discount Stores
|
This site provides users with the information about vb, visual basic, vb6, replace listbox item, how to replace listbox item, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
How to replace listbox item?
The following is the code for how to replace listbox item with text in the textbox:
Dim t As Integer
Private Sub Command1_Click()
List1.RemoveItem t
List1.AddItem Text1.text, t
End Sub
Private Sub Form_Load()
List1.AddItem "test1"
List1.AddItem "test2"
List1.AddItem "test3"
End Sub
Private Sub List1_Click()
t = List1.ListIndex
End Sub
Note:
When you click the listbox item, you get the index of the listbox and with the index, when you click the command button, the item with the index is deleted and the text in the textbox is added, also with the same index. As a result, the item in the listbox is replaced by the text in the textbox.
|