By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,212 Members | 1,505 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,212 IT Pros & Developers. It's quick & easy.

Delete object bound to DataGridView

P: n/a
I have a Generic list of my objects set as datasource of a DataGridView.
In the cell doubleclick event i want to delete the selected object deleting
it from the datasource (the generic list) this way:

System.Collections.Generic.List<WarningDes> _wdes =
(System.Collections.Generic.List<WarningDes>)dataG ridViewCalls.DataSource;

_wdes.Remove((WarningDes)dataGridViewCalls.Rows[e.RowIndex].DataBoundItem);

But I have the following error (the cast looks correct to me):

System.InvalidCastException was unhandled
Message="Unable to cast object of type
'System.Collections.Generic.List`1[WarningDes]' to type
'System.Collections.Generic.List`1[CassiaWarning.FmNewCalls+WarningDes]'."

Any Idea?
Thanks, Diego
May 11 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.