Wednesday, April 29, 2015

just died in violent (အလန္႔တၾကား ေသသြားျခင္း)







Form.Dispose() = Form never closed. It just died in violent. I should have know that.

Form.Close() event မွာ ထည့္ထားတဲ့ ကုတ္ေတြ ဘာလို႔ မ run ပါလိမ့္ ဦးေဏွာက္ေျခာက္သြားတာ တကယ္ေတာ့ Dispose() function ေခၚမိထားတာကိုး။ ကိုယ့္ Form က အလန္႔တၾကား ေသသြားေတာ့ Form ပိတ္ေၾကာင္း အေၾကာင္းၾကားတဲ့ Event ေတာင္ trigger မျဖစ္ေတာ့ဘူးေပါ့...။ အင္း.... ဒါ ျဖစ္သင့္ပါတယ္။ အလန္႔တၾကား ေသသြားတာပဲ...။

C#: Form.Close() vs Form.Dispose()


When working with a Windows GUI, it may seem unclear whether to use Form.Close() or Form.Dispose() to get rid of a dialog at runtime.

Form.Close() removes the dialog from sight and calls the Closing() and Closed() methods. You can still access the form and bring it back later on.

Form.Dispose() destroys the dialog and frees its resources back to the operating system. It does not call the form’s Closing() and Closed() methods. Once disposed, you may not recall a form.

Which to use? If you have no logic in the form’s close methods and don’t intend to re-use the form, go with Dispose(). Otherwise, go with Close(). Some programmers aren’t sure which to use, and they use both – Close() then Dispose()!

ref http://www.alwaysgetbetter.com/



No comments :

Post a Comment

ကြန္းမန္႔ေလး ထားခဲ့ပါလား