Click here to Skip to main content
15,909,199 members
Please Sign up or sign in to vote.
2.00/5 (3 votes)
See more:
Hi all,

I'm facing a small problem in listbox. i didn't get any solution for this.
Problem is:

I need to add item to the Listbox with out opening any other windows or control for entering the value.
simply when i double click on the listbox one editable text box should be open and when i entered the text and click enter it should add to the listbox.
i tried the following example but it doesn't work for adding. Editable Multiline Listbox

Can anybody help me....

Thanks
Harish Reddy
Posted
Comments
dimpledevani 23-Jul-12 9:15am    
on the double click event for your listbox, open a textbox and on the keypress event of textbox for enter key save it in listbox and hide the textbox

 
Share this answer
 
Of course article code does "work for adding", otherwise the author could not demonstrate its operation. If an item cannot be added, there would be nothing to edit, right?

If you don't like the code provided by the author of this article, you can always look at how it works, get the idea and implement your own. I don't see any question here.

—SA
 
Share this answer
 
Comments
Harish Reddy K 24-Jul-12 1:00am    
Of course you are right.. but the author is adding the items while loading the form. not dynamically..
I'll try to find the solution...


--
Harish
Sergey Alexandrovich Kryukov 27-Jul-12 18:43pm    
Oh, I see. Here is the thing: everything which works in Form.Load event handler, will work "dynamically" (you probably mean when a form is already shown). In a way, this is a "fake" event; I never use it, because this is the same as calling the same code as in your handler in the form constructor, at the end. So, I'm sure that if you add items "dynamically", it should work immediately. In word case, you might need to call Invalidate().
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900