| View previous topic :: View next topic |
| Author |
Message |
asianking Expert Cheater
Reputation: 0
Joined: 25 Jun 2008 Posts: 109
|
Posted: Thu Jul 31, 2008 9:06 pm Post subject: Controls One Form From Another (Trainer) Tutorial VB2005 |
|
|
To be able to control form1 from form2; we first must pass the references to form2 or give access to form2 to control form1. For this example; i'm going to use Sword and Sandal 2. I'm assuming you know how to add flash object to vb, get flash loaded with force play, make buttons and experiences call variables... So I'm going to skip those steps...
Make two forms. Form 1 and 2. On Form1, make flash object with a button as below.
| Code: |
Public Class Form1
Inherits System.Windows.Forms.Form
Public myCaller As Form1
Dim myForm As Form2
|
Go back to Form1 design view and double click on Button. Add this codes:
| Code: |
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If myForm Is Nothing Then
myForm = New Form2
myForm.myCaller = Me
End If
myForm.Show()
End Sub
End Class |
This will display form2...
Now Form1 is finish, Continue to Form2 and make a button, Call it Infinite Health.
Example:
Click view codes and enter this codes:
| Code: |
Public Class Form2
Inherits System.Windows.Forms.Form
Public myCaller As Form1
|
Now Go back to Form2 design view; double click on the button and put this codes:
| Code: |
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Call myCaller.Flash.Movie.ToString()
Call myCaller.Flash.SetVariable("game.hero.hitpoints", 9999)
End Sub
|
The first part links the two forms together and the second part, it puts the variable from form1 as string to be used in form2. This is it; so go ahead and test your trainer and see how it is... rep+ if you think it's useful!
note: It took me times to figure this out so I'm just putting it up incase I forget things like this...
_________________
|
|
| Back to top |
|
 |
kitterz Grandmaster Cheater Supreme
Reputation: 0
Joined: 24 Dec 2007 Posts: 1268
|
Posted: Thu Jul 31, 2008 10:41 pm Post subject: |
|
|
Im no expert in vb, but this seems to be the most obvious and easiest things to learn/do.
But nice tut anyways.
|
|
| Back to top |
|
 |
Orbit Advanced Cheater
Reputation: 0
Joined: 09 Dec 2007 Posts: 74
|
Posted: Sat Aug 02, 2008 5:23 am Post subject: |
|
|
This is really easy though but still there may be people who dont know this
As it took you time writing i'l +rep you
_________________
VB2008 Programmer  |
|
| Back to top |
|
 |
|