| View previous topic :: View next topic |
| Author |
Message |
Angemon102 Master Cheater
Reputation: 0
Joined: 08 Sep 2007 Posts: 408 Location: Karachi
|
Posted: Mon Jan 21, 2008 6:42 am Post subject: Bad Coding? VB08 |
|
|
Is this bad coding or something?
| Code: | Private Sub tmrmid_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrmid.Tick
If AxAQ.CurrentFrame >= 81 Then
lblmidvar.Text = AxAQ.GetVariable("_root.m.idLore_monster")
Else
End If
End Sub |
Here I have renamed Form2 to AQ. And AxShockwaveFlash1 to AxAQ. And Label1 to lblmidvar. And Timer1 to tmrmid.
tmrmid is enabled with interval 100 and the rest default. When the If commands are met, the program just hangs/encounters an error.
What's wrong?
_________________
| XHale wrote: | | Angemon102 = cool |
TO DO LIST:
1) Finish and Release that God forsaken trainer
2) Update the updated VB6 Tutorial
3) Learn AAS
4) Do homework...... Damn! |
|
| Back to top |
|
 |
Reak I post too much
Reputation: 0
Joined: 15 May 2007 Posts: 3496
|
Posted: Mon Jan 21, 2008 6:49 am Post subject: |
|
|
I don't know VB but I think it crashes because of the GetVariable().
I think it can't get the variable because it doesn't exist.
Not sure though.
|
|
| Back to top |
|
 |
Mussy69 Grandmaster Cheater
Reputation: 0
Joined: 09 Mar 2007 Posts: 842 Location: Sydney
|
Posted: Mon Jan 21, 2008 7:03 am Post subject: |
|
|
lol rEakW0n, didnt notice?
wrong section buddy uhm general programming i think
_________________
|
|
| Back to top |
|
 |
Symbol I'm a spammer
Reputation: 0
Joined: 18 Apr 2007 Posts: 5094 Location: Israel.
|
Posted: Mon Jan 21, 2008 7:05 am Post subject: |
|
|
This is general programming.
|
|
| Back to top |
|
 |
appalsap Moderator
Reputation: 0
Joined: 27 Apr 2006 Posts: 6753 Location: Pakistan
|
Posted: Mon Jan 21, 2008 7:07 am Post subject: |
|
|
| Yes, because it's VB
|
|
| Back to top |
|
 |
Mussy69 Grandmaster Cheater
Reputation: 0
Joined: 09 Mar 2007 Posts: 842 Location: Sydney
|
Posted: Mon Jan 21, 2008 7:10 am Post subject: |
|
|
lol soz dw,
i was in ms then i went to a bookmarked page that was in this section and i thought i was in ms haha soz guys
_________________
|
|
| Back to top |
|
 |
killersamurai Expert Cheater
Reputation: 0
Joined: 10 Sep 2007 Posts: 197 Location: Colorado
|
Posted: Mon Jan 21, 2008 7:29 am Post subject: |
|
|
use AxAQ.FrameNum
| Code: |
Try
If AxAQ.FrameNum >= 81 Then
llblmidvar.Text = AxAQ.GetVariable("_root.m.idLore_monster")
End If
Catch
lblmidvar.Text = "error"
End Try
|
|
|
| Back to top |
|
 |
atom0s Moderator
Reputation: 205
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
|
Posted: Mon Jan 21, 2008 10:57 am Post subject: |
|
|
The only thing I would say that is bad coding about this is that you have an empty else case. If you are not planning to add anything to it, just remove the else.
| Code: | Private Sub tmrmid_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrmid.Tick
If AxAQ.CurrentFrame >= 81 Then
lblmidvar.Text = AxAQ.GetVariable("_root.m.idLore_monster")
End If
End Sub |
Along with that, if GetVariable fails, it will error the full program and cause it to close, you should add error handling to prevent that.
_________________
- Retired. |
|
| Back to top |
|
 |
|