Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
HookPostNewRow
Message
From
09/09/2004 03:29:45
 
 
To
All
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
HookPostNewRow
Miscellaneous
Thread ID:
00940506
Message ID:
00940506
Views:
63
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
Next
Reply
Map
View

Click here to load this message in the networking platform