Hello:
I have a MDI parent form called FormICEPack and a MDI child called FormLogin.
I want to stay on the FormLogin until the FormLogin has set a variable LoginPass to true;
I spent 2 hours trying to figure it out, so now I am asking the forum for a sample on how I can do it. Anyone have a solution for my issue or where I can go to see a sample?
Loading
NainilPosted Feb 19, 2010, 11:55 AM
Do you mean that you don't want to close the FormLogin until the variable LoginPass is set to true. If that's the case, you can check the value of the variable LoginPass in the FormClosing event of the FormLogin class. If the LoginPass is set to false, you can cancel the closing of the form by using e.Cancel = true, otherwise, you let the operation continue. Let me know that helps and if you need a sample illustrating this.
NainilPosted Feb 19, 2010, 12:51 PM
GustavoPosted Feb 19, 2010, 12:49 PM
YES, YES, YES... you did it again. Exactly what I needed. Now I can implement it into my project.
NainilPosted Feb 19, 2010, 12:42 PM
I did include a zip file. I guess the server might have stripped it. It has happened before. Let me try it again. You can also provide me your e-mail address so that I can send it to you in case this happens again.
GustavoPosted Feb 19, 2010, 12:40 PM
You mentioned "I have included a sample so that you can understand the idea". I dont see the project you included.
NainilPosted Feb 19, 2010, 12:29 PM
For that you will have to delcare an event in the FormLogin class. That event should be raised when the FormLogin is closed, meaning in the FormClosed event of the FormLogin class.
The FormICEPack should subscribe to the new event in the FormLogin class. When the event fires, in the FormICEPack class, you simply call this.Close() and it will close the FormICEPack also. This might sound a little overwhelming without a sample. No worries. I have included a sample so that you can understand the idea.
To see how the project works, run the project first.
Hope this helps you.
GustavoPosted Feb 19, 2010, 12:18 PM
For testing purposes, I also have 'buttonClose_Click'. I would like to have the same code/function as the 'FormLogin_FormClosin', so I dont have to repeat the code. I tried to look where I can have one or the other call the other... but I dont know how to call the other. Do you have a sample?
"
GustavoPosted Feb 19, 2010, 12:07 PM
Thanks, that is what I needed. I was looking for a command loke 'Close' instead of 'Cancel'... The I was putting the code in 'FormClosed' instead of 'FormClosing'...LOL.
Also I would like to have the FormLogin close the FormICEPack, which is the main MDI parent.