V
Victory
i am using the Shown event for a form. It is in .NET 2.0. It is an event
that occurs when a form is displayed. I wanted to use this event since i
needed the processing of data to occur after the form is displayed. To
use it, i had to wire this even to the form: this.Shown += new
EventHandler(myMethod);
In another method (public), which i call from the main form, i pass in
an object then set it to the form's instance variable: i.e.
this.EditObject = passed in object;
Then i invoke the function from main, the first time, the object is
passed. The second time i invoke the form with a different object,
this.EditObject has the correct object instance (i.e. the new one), when
i break in the Shown event handler i.e. myMethod, the install
this.EditObject shows the first invocations object. I sounds like a .NET
bug, has anybody seen this.
in the Form Constructor:
this.Shown += new EventHandler(myMethod);
public void ShowEditDialog(MyObject CurrentObject)
{
this.EditObject = CurrentObject;
ShowDialog();
}
private void myMethod(object sender, EventArgs e)
{
if (this.EditObject.Enabled == true)
{
// .... on second invocation, the previous
// instance of EditObject exists here and not
// the new one.
}
}
Mars
that occurs when a form is displayed. I wanted to use this event since i
needed the processing of data to occur after the form is displayed. To
use it, i had to wire this even to the form: this.Shown += new
EventHandler(myMethod);
In another method (public), which i call from the main form, i pass in
an object then set it to the form's instance variable: i.e.
this.EditObject = passed in object;
Then i invoke the function from main, the first time, the object is
passed. The second time i invoke the form with a different object,
this.EditObject has the correct object instance (i.e. the new one), when
i break in the Shown event handler i.e. myMethod, the install
this.EditObject shows the first invocations object. I sounds like a .NET
bug, has anybody seen this.
in the Form Constructor:
this.Shown += new EventHandler(myMethod);
public void ShowEditDialog(MyObject CurrentObject)
{
this.EditObject = CurrentObject;
ShowDialog();
}
private void myMethod(object sender, EventArgs e)
{
if (this.EditObject.Enabled == true)
{
// .... on second invocation, the previous
// instance of EditObject exists here and not
// the new one.
}
}
Mars