how can i get the index of a selected listview item and index a related arraylist item?

F

forest demon

in a different app, i can grab the index of a ListBox, but when i try
it with a listview with only one column, i'm having issues.

the first line (string) below works as expected.
the second line (string), i want the index of the fField arraylist. i
just have a 0 in there
at this point...i would think there is something similar to indexing a
listbox,
such as lvProductSelection.SelectedIndex


string dTest =
lvProductSelection.SelectedItems[0].ToString().Replace("'", "''");
string iTest = fField[0].ToString().Replace("'", "''");


as usual, i'm probably making this harder than it needs to be.

i appreciate any input...

thanks everyone...
 
G

Guest

hI,

The listview is different, you do not have the SelectedXXXX members
instead each ListViewItem has a Selected property.

You have to iterate to get the selected elements
 
F

forest demon

ignacio said:
hI,

The listview is different, you do not have the SelectedXXXX members
instead each ListViewItem has a Selected property.

You have to iterate to get the selected elements

forest demon said:
in a different app, i can grab the index of a ListBox, but when i try
it with a listview with only one column, i'm having issues.

the first line (string) below works as expected.
the second line (string), i want the index of the fField arraylist. i
just have a 0 in there
at this point...i would think there is something similar to indexing a
listbox,
such as lvProductSelection.SelectedIndex


string dTest =
lvProductSelection.SelectedItems[0].ToString().Replace("'", "''");
string iTest = fField[0].ToString().Replace("'", "''");


as usual, i'm probably making this harder than it needs to be.

i appreciate any input...

thanks everyone...

i got it figured out.

thanks for your input ignacio...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top