Form refresh

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all
I have an application in wich you can insert a new costumer, and like in
Microsoft Outlook 2003, and option "Save and New".
To deal this, I have an event in the edit form, that is raised when the user
saves the customer information. If the property "CreateNew" that comes along
with the custom EventArgs is true, then the child form creates a new form for
this.
Here is the code:

private void edit_Save(object sender, Edit.SaveEventArgs e)
{
if (e.CreateNew)
new();
}

It works fine, but after saving and getting the new screen, the previous
form is still on the screen and only closes when I close the second one - and
it goes on and on until I stop using this function. I believe this happens
because the function is still on (edit_Save). How can I prevent that, with
simplicity, please?

Thanks.
 
Salam

As far as i understand ur problem is that, when New Form Opens , u want to
close the previous form, you can do it by simply closing the current form
before the new statement.

--
ALI RAZA SHAIKH
MCAD.net

www.programmersparadise.cjb.net
alirazashaikh.blogspot.com
 
I do it, and this is my doubt.

private void saveAndNew()
{
// ... some DB Save Routine here...

if (Save != null)
{
Close(); // Closes the form

SaveEventArgs e = new SaveEventArgs();
e.CreateNew = true;
Save(this, e); // Raises the event in the top form
}
}

Now the top form event:

private void edit_Save(object sender, Edit.SaveEventArgs e)
{
if (e.CreateNew)
new();
}

It's working ok, but when the "new();" function is trigerred and the new
form is shown, the last opened form remains open in the background. When I
close the second form, then the old one closes also. If I use saveNew in the
second form also, then both forms will stay open in the background. It's like
the screen is not redrawing itself.

Thanks
 
Back
Top