Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Localization of a form with an empty mmDataGrid
Message
 
To
25/04/2005 07:47:26
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01008021
Message ID:
01008353
Views:
18
This message has been marked as the solution to the initial question of the thread.
Andrew,

>If I try to localise a form (using the LocalizeToolBar) with an empty mmDataGrid (grid showing zero posts and no column headers) then I get this exception when I close the form-localization form, does anyone know what I am doing to cause this?
>
>Exception message : Value cannot be null.
>Parameter name: dataSource

I was able to reproduce this problem (I didn't catch it previously because I never show DataGrids with nothing in them...I always call GetEmptyDataSet() on the business object so there are at least columns in the DataGrid).

ANYWAY, it should work in either case, so I changed mmDataGrid.OnBindData() to check if the grid's DataSource is null before trying to retrieve the currency manager:
if (this.DataSource != null)
{
	// Get the currency manager for the data grid
	CurrencyManager cm = this.GetCurrencyManager();
	// Set the default DataView's AllowNew property to false
	((DataView)cm.List).AllowNew = false;
}
If you need this change sooner than later, you can make it to your MM .NET source code and you'll be set when the next version is released (and I'll give you credit in the What's New Guide!).

Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Previous
Reply
Map
View

Click here to load this message in the networking platform