Question Unable to cast object of type 'System.Windows.Forms.ListView' to type 'FileTool.IListView'

aw48

Active member
Joined
Feb 9, 2013
Messages
36
Location
Germany
Programming Experience
10+
hi, hope everyone's well despite that worldwide turmiol

I'm using VSE 10, c#, WinForms

in my project I have
interface IListView
class MyListViewBase : ListView, IListView
class MyListViewOne : MyListViewBase
class MyListViewTwo : MyListViewBase

IListView MyListView = new MyListViewOne();

I have an issue with
MyListView = (IListView)GlobalListView;
GlobalListView is made with the designer as type ListView but not in the same Application

Everything compiles well but at run-time I get the above mentioned exception.
my guess is it must me done thru the interface but honestly said I don't have the slightest
idea how MyListView could reference another ListView object

What am I missing here ? any help apreciated. I'd be especially thankful for a hint to literature
or tutorial.
thanks in advance
franz
 
The WinForms ListView doesn't implement File.IListView. How could it possibly do so? File.IListView is something you created in 2021, while ListView was written back in the 2002.

If all your list views are based of the WinForms ListView, then use that as the base variable type instead of IListView.
 
Back
Top Bottom