CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28
  1. #16
    Join Date
    Sep 2011
    Posts
    69

    Re: For loop not iterating through a list box

    Hey guys Im in the same position but with another program. Im not planning to sell this one so I can share. It only does what its supposed to do for the first item then just goes down the list not doing it for the rest.

    Code:
                try 
                {
    
               
    
    
    
                    for (int i = 0; i < listBox1.Items.Count; i++)
                    {
                      
    
                        if (listBox1.SelectedIndex < listBox1.Items.Count - 1)
                        {
                        
                            listBox1.SelectedIndex = listBox1.SelectedIndex + 1;
                            listBox1.SetSelected(listBox1.SelectedIndex, true);
                            RefreshIESettings(listBox1.SelectedItem.ToString());
    
    
                            string url = textBox1.Text;
    
                            webBrowser1.Navigate(url);
    
                        }
    
                    }
                }
                    catch (Exception ex)
                {
    
                        MessageBox.Show (ex.Message);
                    }
    
    
                }

  2. #17
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: For loop not iterating through a list box

    Once again you have not shown the code which may explain where the problem is nor did you tell us what it is supposed to do but is not doing.

    It does appear that you would be calling the navigate method in rapid succession and likely only seeing the result of the last call.

    I have no idea where the text in the textbox is coming from nor if it is supposed to change even if it does I would think you would never notice unless you step through the code as it likely is at the last item in the loop before it even bothers to refresh the text shown in the box.
    Always use [code][/code] tags when posting code.

  3. #18
    Join Date
    Sep 2011
    Posts
    69

    Re: For loop not iterating through a list box

    Okay its a program that will visit a site with the proxy that the user imports from a text file. The text above is "supposed" to change settings (proxys) and visit the site.

  4. #19
    Join Date
    Apr 2011
    Posts
    23

    Re: For loop not iterating through a list box

    First you would need to set a proxy
    Ping the website with that proxy
    If the ip gets information through that proxy
    Then test proxy and manually switch by hitting a button such as try next proxy

    There is a program already out there for this task actually several...

    What are you trying to accomplish with this?

    Antibanning script to look for working proxies for some forum or create a bot to spam a forum ?
    I will warn you that with the few clicks of a button it is rather easy to ban your IPs one by one as your bot registers not to mention there are ban lists and many of proxies are already known spam IP's and the ones that are not get added to the listing rather quickly so any spam to boost your rank in google or whatever you are trying to do will easily and quickly be gone there are places dedicated to this 24/7...
    Some kind of bruteforce password cracking utility?
    Or Anonymous surfing which I highly doubt cause there are many free and open source ways to surf anonymously....

    I doubt many will support such a negative piece of software or help you get it working. If you are not able to state its it's reason for being used I would say you are likely posting to deaf ears at this forum while I could be wrong cause I do only speak for myself but it seems that most folks here are only willing to help those that genuinely need support or help.

    Enjoy and good luck with your venture if it is a worthy cause.
    Last edited by infringer; September 17th, 2011 at 12:12 AM.

  5. #20
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: For loop not iterating through a list box

    Did someone say something

    I had a feeling earlier that this person may be up to no good. Looks like that feeling was correct.
    Last edited by DataMiser; September 17th, 2011 at 12:36 AM.
    Always use [code][/code] tags when posting code.

  6. #21
    Join Date
    Sep 2011
    Posts
    69

    Re: For loop not iterating through a list box

    No :| Im not doing spamming or anything ilegal. I just wanted to make a fake traffic generator for one of my sites. It will visit the site with the proxy and count as a view for it. Its mostly just me trying to fix the for loop for my other program.

    I dont need to worry bout the proxy stuff like testing if its alive or not. I already have the proxy code inserted in my code and RefreshIeSettings just calls it and uses the proxy.

    How would I fix the for loop?

  7. #22
    Join Date
    Jan 2009
    Posts
    596

    Re: For loop not iterating through a list box

    Quote Originally Posted by kytro360 View Post
    No :| Im not doing spamming or anything ilegal. I just wanted to make a fake traffic generator for one of my sites. It will visit the site with the proxy and count as a view for it.
    The only reason I can think of for doing this is to make it look that your site is more popular than it really is, maybe to fool advertisers. This would count as fraud, which is illegal.

    If you have another, valid, reason for faking traffic, could you please share it with us?

  8. #23
    Join Date
    Sep 2011
    Posts
    69

    Re: For loop not iterating through a list box

    You guys are overthinking this. Like I said that was just a test. If you dont want to help then dont, Ill ask elsewhere where people dont jump to assumptions :/

  9. #24
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: For loop not iterating through a list box

    What do you expect, you don't show the code but we can tell that you are using multiple proxies and creating accounts or at least are trying to. This is not something most of us would or even could within the rules help with.

    In any case you keep talking about the loop not working but the problem is not the loop. The loop works fine it is your web code which you have not shown that is not working.
    Always use [code][/code] tags when posting code.

  10. #25
    Join Date
    Apr 2011
    Posts
    23

    Re: For loop not iterating through a list box

    What version of .net are you using?

    What is the IDE you are using to do your code?

    What is the error message you are getting?

    There needs to be a better description of the error I dunno weather it is a syntax error or something else...

    Anyhow give the error message. If you get too fed up there is always a program called "MagicTrafficBot" uses multiple browser profiles and such to accomplish the same thing but I will tell you one thing ... While this may increase your Alexia rankings google is now hip to all of this so spamming your link or inflating traffic actually lowers your ranking in google. Just something to take into consideration link farming and fake traffic causes the reverse of what you want to happen over time.

  11. #26
    Join Date
    Sep 2011
    Posts
    69

    Re: For loop not iterating through a list box

    What version of .net are you using?: The latest

    What is the IDE you are using to do your code?: Whats IDE

    What is the error message you are getting?: No error messages

  12. #27
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: For loop not iterating through a list box

    From the looks of it the navigate statement is the issue or one of them anyway.

    Say for example you have 100 items in that list

    You will be sending 100 navigate commands to the browser control in a very short period of time possibly milliseconds which means it does not even come close to having enough time to make a connection before it is told to make a different connection.


    Unless of course the code is stopping and waiting for the connection each time.
    Always use [code][/code] tags when posting code.

  13. #28
    Join Date
    Sep 2011
    Posts
    69

    Re: For loop not iterating through a list box

    How about if I make my program sleep? Or should I incorporate a timer? But the thing about a timer is that if the page loads somehow slower then the set amount it might not work correctly.

Page 2 of 2 FirstFirst 12

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured