| View previous topic :: View next topic |
| Author |
Message |
paddyc Advanced Cheater
Reputation: 0
Joined: 20 Aug 2007 Posts: 66
|
Posted: Sat Apr 12, 2008 8:04 am Post subject: Visual Basic help |
|
|
in batch you can call the top ex.
:top and on the bottom of the batch you write
goto :top so it repeats everything over again.
is there any way to do this in visual basic (6)
thx for all answers
|
|
| Back to top |
|
 |
Psy Grandmaster Cheater Supreme
Reputation: 1
Joined: 27 Mar 2008 Posts: 1366
|
Posted: Sat Apr 12, 2008 9:27 am Post subject: |
|
|
Umm... you mean something like:
| Code: |
If <condition> then
<do something>
<do another thing>
End If
|
You can also look into while loops, that will repeat until a condition changes or becomes true, in various different ways.
Not exactly sure what you mean mate.
But google for the tak you want to perform in VB and i'm sure you'll have some good stuff to look through.
Good luck
|
|
| Back to top |
|
 |
XxOsirisxX Grandmaster Cheater Supreme
Reputation: 0
Joined: 30 Oct 2006 Posts: 1597
|
Posted: Sat Apr 12, 2008 7:47 pm Post subject: Re: Visual Basic help |
|
|
| paddyc wrote: | in batch you can call the top ex.
:top and on the bottom of the batch you write
goto :top so it repeats everything over again.
is there any way to do this in visual basic (6)
thx for all answers  |
Like that you just said, it's a "jump", at VB 6 and others versions (all i been know) that could be trasnlated as "Goto" which is a command not well used at all.. but w.e
And btw, it's not reapeating the program all over again, it just jumping, which apparently, in you code, :top is at top of the program code, so it seen to be re-starting.
VB 6
At VB 6 as others, there are a bunch of ways to re-start. But, since VB6 is not that console application as batch is, i doubt you will find this Goto loop that usefull at all. I would recommend you to look up for "Do/While/Until" "For" "If/Then/Else/Else If"...
_________________
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Sun Apr 13, 2008 8:48 am Post subject: |
|
|
A little easier to understand example:
| Code: | Private Sub Form_Load()
Dim iNumber As Long
iNumber = 0
AddOne:
iNumber = iNumber + 1
AddTwo:
iNumber = iNumber + 2
AddThree:
iNumber = iNumber + 3
Finish:
If iNumber = 6 Then GoTo AddOne
If iNumber = 12 Then GoTo AddThree
MsgBox iNumber
End Sub |
First run through, the value is 6. At Finish, it compares for 6 then jums to AddOne if iNumber is 6. Runs through the additions again then checks for 6 again, at this time the value is 12 so that if will not happen. So the next if is checked against 12, which the value is 12, jumps to AddThree then finishes up as the ifs will both return false then.
_________________
- Retired. |
|
| Back to top |
|
 |
|