Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
HookPostNewRow
Message
De
09/09/2004 03:29:45
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
HookPostNewRow
Divers
Thread ID:
00940506
Message ID:
00940506
Vues:
64
I am working on a WinForms form that allows users to enter and edit data from a single table, one row at a time. (Basically a bunch of labels and bound textboxes. It's like the "Properties" tab of the mmMaintenanceForm without the "List" tab.)

My form derives from mmBusinessForm (not from mmMaintenanceForm).

When a user clicks the New button (which is an mmButtonNew), I'd like to clear all of my bound textboxes, etc., to display the new, empty record.

The MM.NET Developer's Guide explains that this can be done with code like this:
this.BindingContext[this.oOrder.GetCurrentDataSet(), "Orders"].Position = 
	this.oOrder.GetCurrentDataSet().Tables["Orders"].Rows.Count -1;
The only piece of info I'm missing is where to put this code. I've found I can make this work by overriding the form's HookPostNewRow method, like this:
protected override void HookPostNewRow(mmBusinessObject bizObj, string tableName)
{
	base.HookPostNewRow (bizObj, tableName);
	this.BindingContext[this.oStore.GetCurrentDataSet(), "Store"].Position = 
		this.oStore.GetCurrentDataSet().Tables["Store"].Rows.Count -1;
}
However, I get the feeling that this isn't the right way to go about this. Mainly because there are two versions of HookPostNewRow with different parameter signatures. It seems awkward to override both of these in my form and put the same code in both of my overrides.

Is there some other way to hookup the code to move to the new row in my form when the user clicks New, or am I already on the right track?

Thanks,
Ric
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform