Hi.
I need your help please..
I developed a form in Visual C# with a button on it. When I click that button, a sub form appears. Now I want that without processing or filling this sub form, user couldn't access the main form, this main form must be locked or somewhat else... waiting for your reply...
Locking the Form
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.

Augustin Jianu10 reputationPosted Apr 21, 2010, 2:43 AM EDT
private void button1_Click(object sender, EventArgs e)
{
SubForm sf = new SubForm();
sf.ShowDialog();
}
In the SubForm, on the FormClosing event you should have:
private void SubForm_FormClosing(object sender, FormClosingEventArgs e)
{
// if the user didn't fill all the data needed on the subForm you don't allow him to close the subForm
if( ! isAllDataComplete() )
e.Cancel = true;
}