ziggystter2011
Member
- Joined
- May 21, 2011
- Messages
- 5
- Programming Experience
- Beginner
Hi all
I am trying to copy the text from a listbox to a textbox using a timer. However when i run it all works fine intill i try and loop it then i get the following error message.
InvalidArgument=Value of '7' is not valid for 'SelectedIndex'.
Parameter name: SelectedIndex
the code i am using is
Error is raised when the last item in the listbox is selected.
Private curNum As Integer
If curNum = ListBox2.Items.Count Then
Timer2.Stop()
Else
TextBox3.Text = ListBox2.Items.Item(curNum).ToString
curNum += 1
ListBox2.SelectedIndex = (curNum)
any help with this would be great
thanks in advance
Private curNum As Integer
I am trying to copy the text from a listbox to a textbox using a timer. However when i run it all works fine intill i try and loop it then i get the following error message.
InvalidArgument=Value of '7' is not valid for 'SelectedIndex'.
Parameter name: SelectedIndex
the code i am using is
Error is raised when the last item in the listbox is selected.
Private curNum As Integer
If curNum = ListBox2.Items.Count Then
Timer2.Stop()
Else
TextBox3.Text = ListBox2.Items.Item(curNum).ToString
curNum += 1
ListBox2.SelectedIndex = (curNum)
any help with this would be great
thanks in advance
Private curNum As Integer
Last edited: