• Log in or sign up for an account here: https://www.sythe.org/login

Info Between Forms

Jukka

Active Member
Joined
Nov 23, 2005
Sythe Gold
0
Messages
244
Age
34
Location
Finland, Helsinki
Lets say if i have: "Dim FileLocation as String" in Form3.
and i would like to send that variable to Form1?
edit: Solved...


Another problem:
If i have a Text1.Text in form1 and i would like to give it a variable that form3 has.
Using the command in form3

if that makes any sence

edit3 heres some code:

Code:
Private Sub Command2_Click()
  FileLocation = Text1.Text
  Open FileLocation For Input As #1
  Print #1, ScarCode
  Close #1
End Sub

thats in form3 now i want to send the "ScarCode" variable to ScarCodeText.Text
 
Declare it in a module,

Public FileLocation as string
 
Declare it in a module,

Public FileLocation as string

oh TY! ill try it now

edit i got another problem. Look at my first post.
 
Try declaring it like this in a module...
Code:
Global FileLocation, ScarCode as String

And finally change your Command2_Click() to this...
Code:
Private Sub Command2_Click()
  FileLocation = Form1.Text1.Text
  Open FileLocation For Input As #1
  Print #1, ScarCode
  Close #1
End Sub

And for "ScarCode" try this, of course i presume its in form1...?
Code:
Form1.ScarCodeText.Text = ScarCode

As you can see putting "Form1." before the "Text1.Text" tells VB that you want to interact with form1 and not the form that is currently open.
 
You don't have to add it to a module.
Example
Form1 Code:
Code:
public blah as string

private sub form_load()
blah = "hi"
end sub

Form2 Code:
Code:
private sub form_load()
msgbox form1.blah
end sub
 
Runescape Gamblingrunescape gambling
Back
Top