Associate
- Joined
- 6 Dec 2007
- Posts
- 2,103
Hi again, just another quick question. This code:
Is supposed to take the last four letters of each item in the list box, and then put those four letters into a combo box. However, when it comes down to it, it'll run and then when I look what's in the combo box, I get '-1'.
Where did that come from??
EDIT: or better still, does anyone know how to take a substring after a certain character, for example a . or a £? Had a look-see and can't find a thing lol.
Anyone know how I can get around it? Thanks in advance
Code:
For i = 0 To i = (listBox.Items.Count - 1)
Dim myString As String = listBox.Items.IndexOf(i).ToString
Dim mySubstring As String = Microsoft.VisualBasic.Right(myString, 4)
comboBox.Items.Add(mySubstring)
Next i
Is supposed to take the last four letters of each item in the list box, and then put those four letters into a combo box. However, when it comes down to it, it'll run and then when I look what's in the combo box, I get '-1'.
Where did that come from??
EDIT: or better still, does anyone know how to take a substring after a certain character, for example a . or a £? Had a look-see and can't find a thing lol.
Anyone know how I can get around it? Thanks in advance

Last edited: