Hi Doug,
To use the clone method you need to cast the returned value to ListViewItem type. The method returns and object type. Also, you don't send a parameter to the method but call it from the ListViewItem instance that you want to clone. Here is a VB example. I don't have the time to convert it for you but you can get the idea. Instead of CType, use the Convert function.
Dim myEnumerator As IEnumerator = _
Me.ListView1.SelectedItems.GetEnumerator
Me.ListView2.BeginUpdate()
Do While myEnumerator.MoveNext
Me.ListView2.Items.Add( _
CType(CType(myEnumerator.Current, ListViewItem).Clone, _
ListViewItem))
Loop
Me.ListView2.EndUpdate()
>In the one article that comes up in google,
>
http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwindowsformslistviewitemclassclonetopic.asp>I see:
>
>ListViewItem.Clone()
>
>has promise - but there is no example.
>
>I tried a basic
>
>DropDownList Doug = ListViewItem.Clone(ddl);
>
>But no joy - anyone know the correct way to implement this functionality?
>TIA,
>Doug
>>All,
>>
>>I have a dropdown which I populate through a call to SQL server via a SqlDatareader. It has approximately 1100 entries.
>>
>>Can I instantiate 1 control and 'clone' 4 more?
>>
>>If I cannot do that, what strategy are people using to populate controls with multiple instantiations on a page?
>>
>>I could pull down a DataSet, push it into a ViewState or a Session variable, and use this to populate all controls since the data is static.
>>
>>Or should I pull the Data into an XML dataisland and let the information be cached and reused?
>>
>>What technique is everyone using to accomplish this?
>>
>>TIA,
>>Doug
-----------------------------------------
Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.comwww.prenia.comWeblog: blogs.prenia.com/cathi