The program I've been working on is perfect, except for one small issue I cannot seem to resolve, no matter how hard I try - I just don't know whether to post my entire code structure or not, since I can't really figure out exactly where the problem occurs.
I have a NumericUpDown control that specifies how many times to do a selected routine, and it works fine ... The FIRST time - After I click Button2 a second time (After ListBox is cleared and repopulated), the NumericUpDown fails to work - Can anyone see just from this snippet of my code where my issues lie?
I have a NumericUpDown control that specifies how many times to do a selected routine, and it works fine ... The FIRST time - After I click Button2 a second time (After ListBox is cleared and repopulated), the NumericUpDown fails to work - Can anyone see just from this snippet of my code where my issues lie?
Code:
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
Panel1.Height = 502
ListBox1.Height = 472
ListBox1.Items.Clear()
If ComboBox1.Text = "Arooga Slots" Then
TextBox1.Text = "&ts="
End If
If ComboBox1.Text = "Trophy Slots" Then
TextBox1.Text = "coupon="
End If
If ComboBox1.Text = "Kings Of Camelot" Then
TextBox1.Text = "REPLACE"
End If
On Error Resume Next
Dim tags = WB.Document.GetElementsByTagName("A")
For Each t In tags
Dim address As String = CType(t, HtmlElement).GetAttribute("href").ToString
If ComboBox2.Text = "Collect All Links" Then
If address.Contains(TextBox1.Text) Then
If Not ListBox1.Items.Contains(address) AndAlso Not address.EndsWith("&ref=nf") Then
ListBox1.Items.Add(address & vbNewLine)
End If
End If
End If
If address.Contains(TextBox1.Text) AndAlso address.Contains(TextBox2.Text) Then
If Not ListBox1.Items.Contains(address) AndAlso Not address.EndsWith("&ref=nf") Then
ListBox1.Items.Add(address & vbNewLine)
End If
End If
Next
If ListBox1.Items.Count = 0 Then
MsgBox("No links found!")
Panel1.Height = 65
ListBox1.Height = 30
End If
'This removes all duplicates from a listbox
Dim i, j As Integer
Dim arr As New ArrayList
Dim itemfound As Boolean
For i = 0 To ListBox1.Items.Count - 1
itemfound = False
For j = 0 To i - 1
If ListBox1.Items.Item(i) = ListBox1.Items.Item(j) Then
itemfound = True
Exit For
End If
Next j
If Not itemfound Then
arr.Add(ListBox1.Items.Item(i))
End If
Next i
ListBox1.Items.Clear()
ListBox1.Items.AddRange(arr.ToArray)
arr = Nothing
ToolStripStatusLabel2.Text = ListBox1.Items.Count & " Links Found"
NumericUpDown1.Value = ListBox1.Items.Count
End Sub