R
Ray Mitchell
Hello,
In the following code assume that the ListView object "myListView" has been
properly created. What I am attempting to do is add a string[] as a list
view item, then read the various string elements from the list view item. I
assume I am adding the string[] item properly, but I get the error
indicatede when I try to read one of the string[]'s elements from the
ListView item. What am I missing?
public void Test()
{
ListView.ListViewItemCollection itemCollection =
new ListView.ListViewItemCollection(myListView);
// for use as a ListView item
string[] record = new string[10];
// create a ListView item
ListViewItem lvItem = new ListViewItem(record);
// add item to ListView
itemCollection.Add(lvItem);
// Try to read element 0 of the string[] in the ListView item at index 0
// Error: Cannot convert type 'System.Windows.Forms.ListViewItem' to
'string[]'
string itemField = ((string [])itemCollection[0])[0];
}
Thanks,
Ray Mitchell
(e-mail address removed)
In the following code assume that the ListView object "myListView" has been
properly created. What I am attempting to do is add a string[] as a list
view item, then read the various string elements from the list view item. I
assume I am adding the string[] item properly, but I get the error
indicatede when I try to read one of the string[]'s elements from the
ListView item. What am I missing?
public void Test()
{
ListView.ListViewItemCollection itemCollection =
new ListView.ListViewItemCollection(myListView);
// for use as a ListView item
string[] record = new string[10];
// create a ListView item
ListViewItem lvItem = new ListViewItem(record);
// add item to ListView
itemCollection.Add(lvItem);
// Try to read element 0 of the string[] in the ListView item at index 0
// Error: Cannot convert type 'System.Windows.Forms.ListViewItem' to
'string[]'
string itemField = ((string [])itemCollection[0])[0];
}
Thanks,
Ray Mitchell
(e-mail address removed)