..Row cannot be cast to ..Row when appear to be same. InvalidCastException

rowTS = CType(TimeSheetBindingSource.Current, DataRowView.Row, dsMyCo.TimeSheetRow

A first chance exception of type ‘System.InvalidCastException’ occurred in MyCompany.exe

[A]TimeSheetRow cannot be cast to [B]TimeSheetRow. Type A originates from ‘ProjectName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ in the context ‘Default’ at location ‘Project…\bin\Debug\ProjectName.exe’. Type B originates from ‘ProjectName, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ in the context ‘Default’ at location Project…\bin\Debug\ProjectName.exe’.

Check you are converting from Rows in the same dataset. So if a table appears in more than one dataset check you are using the correct one.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: