Malfunction Posted February 26, 2004 Posted February 26, 2004 Hi, I'm using a dialog in order to change properties of an object: if (myDialog.ShowDialog() == DialogResult.OK) { actFunny(); } actFunny() changes the properties just fine right after the dialog was closed. But the dialog object is still present otherwise I couldn't retrieve the rewuired informations of it. So how do I dispose the dialog object after using it? I've never seen the dialog object beeing disposed in one of the examples. Since I'm giving the dialog necessary parameters in it's constructor it has to be created newly. Quote Debug me...
Administrators PlausiblyDamp Posted February 26, 2004 Administrators Posted February 26, 2004 You could probably do something like myDialog.Dispose(); if you really felt the urge but if you leave it alone .Net's garbage collector will get round to deleting it eventually. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Malfunction Posted March 10, 2004 Author Posted March 10, 2004 I was rethinking my current implementation and found my way of passing and retrieving values of and from my dialog very ugly. E.g. I have an object X which has three integer values (private members). These values can be changed through a dialog. Object X opens the dialog passing it's three integer values through the dialog's constructor (correct me if that's bad style already). After the dialog is closed object x needs to know the new values. Right now my dialog has three public members which hold the three integer values. So after closing the dialog object X reads these fields directly :/ Quote Debug me...
Heiko Posted March 10, 2004 Posted March 10, 2004 I'd rather have private members and expose them through properties. So you can set them readonly if required. Quote .nerd
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.