Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Deriving Windows Forms from a Modified MM.Net Framework
Message
De
10/04/2008 10:11:21
Frank Dolinar
Mi House of Representatives
Michigan, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Novell 6.x
Database:
MS SQL Server
Divers
Thread ID:
01309082
Message ID:
01309685
Vues:
8
Hi, Kevin,
Are these custom methods? Yes, but...
In addition, we have rearranged some controls (buttons) so that we have one button (New) on the first tab of the mmMaintenanceForm and three buttons (Save; Revert; Cancel) on the second tab.
Here's the specific situation.
We are rewriting the local Human Resources system and have decided to match functionality of the existing VFP8 system (insofar as possible) in the implementation of the new .Net system.

We have used your mmBtnCancel twice (for the Revert and Cancel) because the existing system uses a Revert button to back out of changes on what you call the properties tab and stays on that tab. The Cancel button does that same process and then returns to the first tab on the form. In either case calling 'base.CancelButton.PerformClick()' in your framework seemed to be the simplest & most direct approach.

We have also added code that fires when the user selects (clicks on) either the first or second tab because we wanted to be able to add functionality in derived forms for these events.

I appear to have two problems and both appear to be related to the fact that C# doesn't have a WithEvents descriptor -- which, based on my reading, means that I have to have an 'mmbtnCancel_click' method in the framework's C# code to provide something for the Cancel button on the derived form to work with.

The code on the framework is:
protected virtual void mmbtnCancel_click( object sender, EventArgs e )
{
base.CancelButton.PerformClick();
this.TabControl.SelectedTab = this.ListPage;
}

Problem # 1:
If I don't add any code in the derived form behind the Cancel button, I get the following error:
"Object reference not set to an instance of an object."

Problem # 2:
If I do add code in the derived form behind the Cancel button, as shown here...

Protected Overrides Sub mmbtnCancel_Click( _
ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles mmbtnCancel.Click

I get a different error:
"Handles clause requires WithEvents variable defined in the containing type or one of its base types"

As usual, I suspect I've missed something. Any advice would be much appreciated.

Thanks,
Frank
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform