Hi Frank,
>Hi, Tim,
> I tried your code.
> Based on my reading of your explanation, specifically the phrase "your form", I placed the code you suggested in my modified mmMaintenanceForm. If I have misunderstood, please advise.
> Regardless, that didn't work.
> I then tried the equivalent code in the end user form in my application.
> That didn't work either.
> I have verified that the code does not execute in either case.
>
> I have also verified that mmButtonCancel_Click in mmButtonCancel.cs and CancelHandler in mmButtonHelper do execute, as expected.
>
> I also tried Kevin's suggestion, in the modified mmMaintenanceForm and in my end user form.
> No joy there either.
>
> I'm a long time Fox developer who's now learning .Net. If I was trying this in VFP it would be a couple of lines of obvious code and I'd be done. What makes it so difficult using .Net?
>
> Sorry for the kvetch. It seems like this should be dead easy and it's proving to be anything but. It's frustrating.
>
> As usual, any further suggestons or help will be much appreciated.
>
>Thanks,
>Frank
Here is what I tried:
I set the CancelButton property of the form to my cancel button.
I set the FocusOnCancel property to the listPage and it didn't do anything. Then I created a handler for the cancel button like below and it called the cancel alright, but didn't re-focus based on the FocusOnCancel property.
So I override the Cancel method for the form like I showed you (also shown below), and added the SetFocus() method and that didn't work either, so I just added a TabControl.SelectedIndex = 0 and that did the trick.
Maybe Kevin can elaborate more about the property and the method that should work. I will look at his code a little later to see what it does and maybe trace it in the debugger.
Tim
public override void Cancel()
{
base.Cancel();
this.SetFocus(this.ListPage);
this.TabControl.SelectedIndex = 0;
}
private void mmButtonCancel1_Click(object sender, EventArgs e)
{
this.Cancel();
}
Timothy Bryan