Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Retrieve values from a ListView
Message
From
01/09/2005 12:24:54
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Miscellaneous
Thread ID:
01045471
Message ID:
01045890
Views:
26
Oooops, sorry Pete ... I meant to use the Text property of the SubItems. My bad. =(

And yes, you can use the sender parameter. You just cast it to a ListView. So, something like this:
ListView oList = (ListView)sender;
ListViewItem item = oList.SelectedItems[0];
int paydetailsid = (int)item.SubItems[10].Text;
int payaddressid = (int)item.SubItems[11].Text;
~~Bonnie


>Hello Bonnie, just thought I'd bring you up to date with lv saga, I tried the code you suggested but received an error ( not verbatim ) stating "Cannot cast Listview.Subitem to type int", I then tried this code which works
>
>
>    ListViewItem item = this.lvClaims.SelectedItems[0];
>    int paydetailsid = Convert.ToInt32(item.SubItems[10].Text);
>    int payaddressid = Convert.ToInt32(item.SubItems[11].Text);
>
>
>thanks for putting me on the right track, is there a way of casting the sender parameter to retrieve the same info ?
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform