Link to home
Start Free TrialLog in
Avatar of drcyrus3d
drcyrus3d

asked on

I get an error when i try to add new item to a listbox.

Hy

This is a part from my code:

For ci = 0 To ListBox2.Items.Count
                If TextBox7.Text = ListBox2.Items.Item(ci) Then
                    GoTo Same_ID
                End If
            Next
            ListBox2.Items.Add(TextBox7.Text)

when it arrives at :            ListBox2.Items.Add(TextBox7.Text)

it gives me this error:

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.

What should i do??
ASKER CERTIFIED SOLUTION
Avatar of gregoryyoung
gregoryyoung
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of drcyrus3d
drcyrus3d

ASKER

That was the problem. Thanx a lot.