Search Results

Search found 1 results on 1 pages for 'redhaze'.

Page 1/1 | 1 

  • VB.NET 2008 Application crashing during Do Loop

    - by RedHaze
    I am writing an application to compare each item on listbox1 to all items on listbox2. If the item is found, then remove it from both lists. The goal is to only have the items that were not found remain on both lists. The problem is, the application just hangs and I never get any results. I looked at my code several times and I cannot figure out what's going on (programming noob I know...). Can anybody help me with this? Code Snippet: Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim a As String Dim b As String Dim y As String For i As Integer = 0 To ListBox1.Items.Count - 1 a = ListBox1.Items(i) y = 1 Do While y = 1 For x As Integer = 0 To ListBox2.Items.Count - 1 b = ListBox2.Items(x) Dim res As Int16 = String.Compare(a, b) If res = 0 Then y = 0 ListBox2.Items.Remove(i) ListBox2.Items.Remove(x) ElseIf x = ListBox1.Items.Count Then Exit Do End If Next Loop Next End Sub

    Read the article

1