Click here to Skip to main content
16,020,512 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
If i keep on adding items in listbox in a loop for 1 or more than of that continuesly
is it possible that after some perticular period of time listbox may become null
that is
listbox1 = null is it possible ?

remember i dont clear items from listbox
Posted

Wait a second.

If you assign null to any variable of a reference type, you don't do anything to the object itself. You modify the value of this variable (or a member of some class or structure), but this is only a reference to this object. However, as a result, the object may loose reachability. The CLR can figure out that the object cannot be accessed from anywhere in the executing code; and in this case the object can be destructed by the Garbage Collector (GC) — please see about reachability and garbage collection here:
http://en.wikipedia.org/wiki/Garbage_collector_%28computing%29[^].

Just think about it. I feel you are missing something very basic and important.

Now, this all has nothing to do with items in the list box. The items can be removed, for example, by the method Clear.

—SA
 
Share this answer
 
v2
Yes there is a limit to the number of items that you can stuff into a listbox. Of course, writing a program that does nothing but add an empty string to a listbox is pretty much nonsensical.
 
Share this answer
 

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