• Welcome to Valhalla Legends Archive.
 

Basic VB Question

Started by ChR0NiC, October 06, 2003, 01:49 AM

Previous topic - Next topic

ChR0NiC

Private Sub Command3_click()
Listno = 0
Do
   listrtn = List1.List(Loopno)
   WebBrowser1.Navigate http://www./rankings.php?type= & listrtn & "&submit=Invite")
   Pause delay5.Text
   List1.RemoveItem (lstrtn)
   listamt = listamt - 1
   Label3.Caption = List1.ListCount
   start1 = Timer
   Do While Timer < (start1 + 3)
      DoEvents
      Loop
Loop While listamt > 0
End If
End Sub

Ok I am using this to remove one item from the list one by one, and it goes to the URL. Now I want to make a stop button to stop the looping and countdown. I have no idea how to do that. Can anyone help me out??

Arta

Hackish and unpleasent way but easy:

Add a global boolean variable to your project. Call it AbortLoop or somesuch. Set it to false when your countdown starts. Put a button on your form, call it 'Abort'. In your OnClick handler, set AbortLoop to true. In that loop you posted, add an if statement to see if AbortLoop is true or false. If it's false, carry on. If it's true, break out of the loop.

Adron

Quote from: Arta[vL] on October 06, 2003, 06:57 AM
Hackish and unpleasent way but easy:

Add a global boolean variable to your project. Call it AbortLoop or somesuch. Set it to false when your countdown starts. Put a button on your form, call it 'Abort'. In your OnClick handler, set AbortLoop to true. In that loop you posted, add an if statement to see if AbortLoop is true or false. If it's false, carry on. If it's true, break out of the loop.

That seems like the right way to do it. Why don't you love it?

Kp

Quote from: ChR0NiC on October 06, 2003, 01:49 AM
   WebBrowser1.Navigate http://www./rankings.php?type= & listrtn & "&submit=Invite")
This domain is entirely bogus.  It requests a top-level host named www, which does not exist.  If you're trying to access a host named www in your current domain, you should either construct the hostname from system calls or leave off the trailing dot.  When a name is supplied "bare" (that  is, "www"), the resolver will first try it as a top-level name, then as the supplied name + ".current_domain", whatever that is.  For someone on a Valhalla terminal, asking for host yoni would end up looking for "yoni.valhallalegends.com" after looking for a top-level computer named "yoni" failed.  Supplying a trailing dot forces the resolver not to try guessing the host to be in the current domain if lookup as-specified fails.

Unfortunately, I've seen some resolvers which were implemented improperly and do not support the suppression behavior.  Relying on this bug is a bad idea.
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

iago

Quote from: Kp on October 07, 2003, 10:43 AM
Quote from: ChR0NiC on October 06, 2003, 01:49 AM
   WebBrowser1.Navigate http://www./rankings.php?type= & listrtn & "&submit=Invite")
This domain is entirely bogus.  It requests a top-level host named www, which does not exist.  If you're trying to access a host named www in your current domain, you should either construct the hostname from system calls or leave off the trailing dot.  When a name is supplied "bare" (that  is, "www"), the resolver will first try it as a top-level name, then as the supplied name + ".current_domain", whatever that is.  For someone on a Valhalla terminal, asking for host yoni would end up looking for "yoni.valhallalegends.com" after looking for a top-level computer named "yoni" failed.  Supplying a trailing dot forces the resolver not to try guessing the host to be in the current domain if lookup as-specified fails.

Unfortunately, I've seen some resolvers which were implemented improperly and do not support the suppression behavior.  Relying on this bug is a bad idea.

My God, you wrote a lot for an obvious typo :P
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Adron

Quote from: iago on October 07, 2003, 08:57 PM
My God, you wrote a lot for an obvious typo :P

Or, for someone not wanting to reveal what page he's working with.

Kp

Quote from: Adron on October 08, 2003, 10:51 AM
Quote from: iago on October 07, 2003, 08:57 PM
My God, you wrote a lot for an obvious typo :P
Or, for someone not wanting to reveal what page he's working with.
Even so, his URL won't work.  If he just wanted to reference it on the local domain, he ought to use "www" without the dot, like I told him. :)
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

iago

Quote from: Kp on October 08, 2003, 04:08 PM
Quote from: Adron on October 08, 2003, 10:51 AM
Quote from: iago on October 07, 2003, 08:57 PM
My God, you wrote a lot for an obvious typo :P
Or, for someone not wanting to reveal what page he's working with.
Even so, his URL won't work.  If he just wanted to reference it on the local domain, he ought to use "www" without the dot, like I told him. :)

I very much doubt he's trying to do that :-P
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


MyndFyre

Quote from: iago on October 08, 2003, 04:25 PM
Quote from: Kp on October 08, 2003, 04:08 PM
Quote from: Adron on October 08, 2003, 10:51 AM
Quote from: iago on October 07, 2003, 08:57 PM
My God, you wrote a lot for an obvious typo :P
Or, for someone not wanting to reveal what page he's working with.
Even so, his URL won't work.  If he just wanted to reference it on the local domain, he ought to use "www" without the dot, like I told him. :)

I very much doubt he's trying to do that :-P

Yeah Kp - looks like he's just trying to not show you what site he's accessing.
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Kp

Quote from: Myndfyre on October 08, 2003, 04:44 PM
Yeah Kp - looks like he's just trying to not show you what site he's accessing.
That's still a very poor reason for posting a clearly bad hostname! :)
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Arta

Quote from: Adron on October 06, 2003, 10:59 AM
That seems like the right way to do it. Why don't you love it?

Just seems ugly. Using a global variable for flow control? Not to mention it's a solution that requires a multithreading.

Adron

Quote from: Arta[vL] on October 08, 2003, 06:39 PM
Just seems ugly. Using a global variable for flow control? Not to mention it's a solution that requires a multithreading.

It doesn't. DoEvents will poll for mouse events and call the OnClick handler for the Cancel button if needed. And you're right that he doesn't need a global variable, a private one would do, but that's a minor change and most likely he'd do it with a private one even though you stated to use a global variable.