Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27418

[RESOLVED] Routine does not follow 'specified count'

$
0
0
I have a Listbox that populates with 'grabbed' links for a game I play to collect 'Bonus Coins' from the Facebook Feed, and up until yesterday it was working fine - I only added an extra function for a completely different routine, so I'm pretty sure that's not the problem ...

The problem is that I have a NumericUpDown that controls how many links in the list are opened, and now for some reason when the button is clicked to start the routine, it only does HALF of the specified amount in the NumericUpDown - If I set the amount to '10', it only does 5 links, etc - As I said, up until yesterday it was working as expected, and I really don't see how the changes I made would have affected THAT function o.O

Routine code:

Code:

    Private Sub Button6_Click(sender As System.Object, e As System.EventArgs) Handles Button6.Click
        Dim i As Integer
        For i = 0 To ListBox1.Items.Count - 1
            If i = (NumericUpDown1.Value) Then
                Exit For
            End If
            ListBox1.SelectedIndex = 0
            ListBox1_DoubleClick(ListBox1, EventArgs.Empty)
        Next
        NumericUpDown1.Value = ListBox1.Items.Count
    End Sub

Changes I had made to 'other' routine:

Code:

        If ListBox1.Items.Count = 0 Then
            MessageBox.Show("There are no links to copy!", "Empty List", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
        Else
            Dim buffer As New StringBuilder

      I added this section -->    If CheckBox1.CheckState = CheckState.Checked Then
                For i As Integer = 0 To ListBox1.Items.Count - 1
                    buffer.Append(ListBox1.Items(i).ToString)
                    buffer.Append(vbCrLf)
                Next
            Else
                For i As Integer = 0 To ListBox1.Items.Count - 1
                    buffer.Append(ListBox1.Items(i).ToString)
                Next
            End If -->

            My.Computer.Clipboard.SetText(buffer.ToString)

What I added is not even in the same routine, and I can't for the life of me figure out why it's only doing half of the specified amount :-(

Viewing all articles
Browse latest Browse all 27418

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>