Freakshow Posted November 23, 2003 Posted November 23, 2003 Hi, I have a listview in my form with 3 collums (Nr - Name - Type) and an unknown number of row. When i select a row, i want to read the value of the Nr collum. To make a long story short: I have figured our how to add items in the listview, but i don't know how to read them :( It's my first year programming at high-school so my knowlege isn't that big... Thnx in advance Freak Quote
*Experts* Volte Posted November 23, 2003 *Experts* Posted November 23, 2003 ListView1.Items(itemIndex).SubItems(subItemIndex) Quote
Freakshow Posted November 23, 2003 Author Posted November 23, 2003 Well i already tried that. But the problem is that you need to define the itemIndex to a indexnumer. But when you select another row the value of the indexnumbers dousn't change. So you keep on reading the same line. And that's not the point :) Or am i missing something here? Quote
*Experts* Volte Posted November 23, 2003 *Experts* Posted November 23, 2003 use ListView1.SelectedItem to reference the currently selected item. So ListView1.SelectedItem.SubItems(subItemIndex) Quote
Freakshow Posted November 23, 2003 Author Posted November 23, 2003 Private Sub lstApp_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstApp.SelectedIndexChanged txtAppNr.Text = lstApp.SelectedItems.Item(0).Text End Sub this should be the code then? Well it works if you only select 1 and you do not select another again. If you do, this error appears: An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in system.windows.forms.dll Additional information: Specified argument was out of the range of valid values. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.