I am working on a custom control which should allow the adding, editing, and removing of items similar to the way in which a listbox works.
To add an item programatically in a listbox you would use the following example:
Listbox1.Items.Add("Test")
I want the same functionality in my custom control. How would I go about this?
Loading
NITIN JAINPosted Feb 21, 2010, 11:20 AM
2. Draw a TextBox
3. go to property of this TextBox and set name = 'text_Item'
4. Draw a ListBox
5. go to property of this ListBox and set name = 'list_Item'
6. Draw 1st CommandButton
7. go to property of this first CommandButton and set name = 'btn_add'; also in property text = '&Add'
8. Draw 2nd CommandButton
9. go to property of this second CommandButton and set name = 'btn_delete'; also in property text = '&Delete'
10. Draw 3nd CommandButton
11. go to property of this third CommandButton and set name = 'btn_Edit'; also in property text = '&Edit'
Now coding
right click on first command button and choose View code.
type this
list_Item.items.add(text_Item.text)
list_item.items.refresh()
text_item.text = ""
=============================================
right click on second command button and choose View code.
type this
list_Item.items.delete(list_item.selectedindex)
text_item.text = ""
===========================================
right click on third command button and choose View code.
type this
list_Item.selectedindex.text = text_item.text
text_item.text = ""
======================================