Click here to Skip to main content
15,074,987 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Respected Sir...

In my case of problem there is two Button in one form ,and i open same form on different buttons click event but i do different operation, assume that in textbox of form i insert data to table1 and second time while this form open with second buttons click event than i insert data to table2,now problem is that while i input text to textbox then i close with close button of titlebar then i open form with second buttons click event the form having text which i entered last time ..

I also try me.textbox.dispose() in form closing event ,
but in secondtime textbox is nt available because text box is disposed,..
so how to solve..it
Posted
Comments
Pheonyx 13-Mar-13 7:16am
   
I'm sorry, I do not fully understand what you are asking. Could you clarify please?
Also, could you give a code example if possible?
chetankhatri 13-Mar-13 7:22am
   
Thank you ..for reply
There is 3 form in vb.net,named form1,form2
form1 having two button button1 and button2
on click event of button1 and button2 form2 is opening
form2 having one textbox only
now problem is in form2's textbox,I input any text then i click on close button of titlebar of form,so form2 is closed..
then when i click on button2 then form2 open with having text in textbox1.
so i dont want that text.
Pheonyx 13-Mar-13 7:46am
   
How are you launching form 2?
Please provide a code snippet.

1 solution

The question makes no sense. In .NET, garbage collection is automatic, performed by GC. You don't need to do anything about it. Please see:
http://en.wikipedia.org/wiki/Garbage_collection_%28computer_science%29[^].

And System.IDisposable or System.IDisposable is generally unrelated to GC.

However, you should not create memory leaks which can appear by wrong desing preventing GC from doing its work. You can find further detail in my past answers:
Garbage collectotion takes care of all the memory management[^],
deferring varirable inside the loop can cuase memory leak?[^],
Best way to get rid of a public static List Causing an Out of Memory[^],Memory management in MDI forms[^].

See also: http://msdn.microsoft.com/en-us/library/system.idisposable.aspx[^].

—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