Hi,
I have a user control and when this user control is added to a form, I get the below error.
"Unable to cast object of type 'MS.Internal.NamedObject' to type 'Concept.UsergroupMasterDataSet'."
Below is my code for user control :
namespace Concept
{
/// <summary>
/// Interaction logic for usrctrlUsergroupMaster.xaml
/// </summary>
public partial class usrctrlUsergroupMaster : UserControl
{
Concept.UsergroupMasterDataSet usergroupmasterdataset;
Concept.UsergroupMasterDataSetTableAdapters.UsergroupsTableAdapter usergroupmasterusergrouptableadapter;
public usrctrlUsergroupMaster()
{
InitializeComponent();
usergroupmasterdataset = ((Concept.UsergroupMasterDataSet)(this.FindResource("usergroupmasterdataset")));
usergroupmasterusergrouptableadapter = new Concept.UsergroupMasterDataSetTableAdapters.UsergroupsTableAdapter();
}
private void ctrlUsergroupMaster_Loaded_1(object sender, RoutedEventArgs e)
{ this.usergroupmasterusergrouptableadapter.Fill(this.usergroupmasterdataset.Usergroups);
System.Windows.Data.CollectionViewSource usergroupviewsource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("usergroupviewsource")));
usergroupviewsource.View.MoveCurrentToFirst();
}
}
}