anandasa Posted May 9, 2003 Posted May 9, 2003 Hi Can any one tell us the way to retrieve the row number in the list view control through a VB.NET application? Thank you Regards Ananda Saravanan A Quote
a_jam_sandwich Posted May 9, 2003 Posted May 9, 2003 the row number for what? selected row, last row????. please expand what you mean Andy Quote Code today gone tomorrow!
a_jam_sandwich Posted May 9, 2003 Posted May 9, 2003 ListView1.SelectedItems(0).Index() That will give the index of the row within the listview Andy Quote Code today gone tomorrow!
anandasa Posted May 12, 2003 Author Posted May 12, 2003 Hi Andy Iam getting error like, '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' when I used your syntax. Even though I had two rows with value in the list view. Regards Anand Quote
*Experts* Nerseus Posted May 12, 2003 *Experts* Posted May 12, 2003 I'm guessing you have no selected row so trying to reference row 0 isn't valid. You'll have to check to the number of selected rows bofore using that code. -Nerseus Quote "I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
git Posted May 12, 2003 Posted May 12, 2003 (edited) You can use the following code to select the last item enterd. 'does the listcontain items?? If Me.ListBox1.Items.Count() > 0 Then 'If no selection, choose last list item. If Me.ListBox1.SelectedIndex = -1 Then Me.ListBox1.SelectedIndex = Me.ListBox1.Items.Count() - 1 End If End If regards hilmar Edited May 12, 2003 by git 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.