all groups > dotnet windows forms designtime > april 2005 >
You're in the

dotnet windows forms designtime

group:

ListView Column's AddRange is adding the wrong array type of items in InitializeComponent


ListView Column's AddRange is adding the wrong array type of items in InitializeComponent jrhoads23 NO[at]SPAM hotmail.com
4/29/2005 9:07:49 AM
dotnet windows forms designtime:
I have a custom list view "MyListView" (inherited from
System.Windows.Forms.ListView) which has a "Columns" property.
"Columns" if of type "MyColumnHeaderCollection" which is inherited from

System.Windows.Forms.ListView.=ADColumnHeaderCollection.
MyColumnHeaderCollection is a collection of "MyColumnHeader" objects
which are inherited from System.Windows.Forms.ColumnHea=ADder.


I can go in the and add an instance of MyListView to a form and add
columns to it. In the InitializeComponent call, the List View is
created with the correct type (MyListView), the individual columns are
created with the correct type (MyColumnHeader), but the AddRange call
defines the columns as System.Windows.Forms.ColumnHea=ADder() and not
MyColumnHeader().


What am I doing wrong or missing to get the AddRange call to use the
correct type???


Below is a snip from the automatically generated InitializeComponent
function...


<System.Diagnostics.DebuggerSt=ADepThrough()> Private Sub
InitializeComponent()
Me.ListView1 =3D New MyListView
Me.ColumnHeader1 =3D New MyColumnHeader
Me.ColumnHeader2 =3D New MyColumnHeader
'
'ListView1
'
Me.ListView1.Columns.AddRange(=ADNew
System.Windows.Forms.ColumnHea=ADder()
{Me.ColumnHeader1, Me.ColumnHeader2})
Me.ListView1.Location =3D New System.Drawing.Point(100, 200)
Me.ListView1.Name =3D "ListView1"=20
Me.ListView1.TabIndex =3D 5=20
End Sub
Re: ListView Column's AddRange is adding the wrong array type of items in InitializeComponent joeycalisay
5/3/2005 12:00:00 AM
Do you have an AddRange method in your MyColumnHeaderCollection?

--
Joey Calisay
http://spaces.msn.com/members/joeycalisay/


[quoted text, click to view]
I have a custom list view "MyListView" (inherited from
System.Windows.Forms.ListView) which has a "Columns" property.
"Columns" if of type "MyColumnHeaderCollection" which is inherited from

System.Windows.Forms.ListView.­ColumnHeaderCollection.
MyColumnHeaderCollection is a collection of "MyColumnHeader" objects
which are inherited from System.Windows.Forms.ColumnHea­der.


I can go in the and add an instance of MyListView to a form and add
columns to it. In the InitializeComponent call, the List View is
created with the correct type (MyListView), the individual columns are
created with the correct type (MyColumnHeader), but the AddRange call
defines the columns as System.Windows.Forms.ColumnHea­der() and not
MyColumnHeader().


What am I doing wrong or missing to get the AddRange call to use the
correct type???


Below is a snip from the automatically generated InitializeComponent
function...


<System.Diagnostics.DebuggerSt­epThrough()> Private Sub
InitializeComponent()
Me.ListView1 = New MyListView
Me.ColumnHeader1 = New MyColumnHeader
Me.ColumnHeader2 = New MyColumnHeader
'
'ListView1
'
Me.ListView1.Columns.AddRange(­New
System.Windows.Forms.ColumnHea­der()
{Me.ColumnHeader1, Me.ColumnHeader2})
Me.ListView1.Location = New System.Drawing.Point(100, 200)
Me.ListView1.Name = "ListView1"
Me.ListView1.TabIndex = 5
End Sub

Re: ListView Column's AddRange is adding the wrong array type of items in InitializeComponent jrhoads23 NO[at]SPAM hotmail.com
5/25/2005 9:37:05 AM
Yes. I do have an AddRange in MyColumnHeaderCollection. It just called
the base class AddRange (see below)...

public void AddRange(MyColumnHeader[] items)
{
base.AddRange(items);
}



[quoted text, click to view]
AddThis Social Bookmark Button