Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cancel Button on Modified mmMaintenanceForm
Message
From
24/04/2008 18:06:09
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
24/04/2008 12:10:28
Frank Dolinar
Mi House of Representatives
Michigan, United States
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Novell 6.x
Database:
MS SQL Server
Miscellaneous
Thread ID:
01312518
Message ID:
01313021
Views:
13
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 didn't work
	this.SetFocus(this.ListPage);
	// But this did.
	this.TabControl.SelectedIndex = 0;
}

private void mmButtonCancel1_Click(object sender, EventArgs e)
{
	this.Cancel();
}
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform