|
-
March 31st, 2001, 10:08 AM
#1
from one form to the other form
i have 2 forms named "frmMain" and "frmCustom".
'in frmMain
option Explicit
' Global variables hold the total number of columns and rows
private TotalCols as Integer
private TotalRows as Integer
private Sub Form_Load()
TotalCols = frmCustomField.CWidth
TotalRows = frmCustomField.CHeight
End Sub
--------------------------------------------------------------
' in frmCustom
option Explicit
private Sub cmdOk_Click()
Dim CHeight as Integer, CWidth as Integer
CHeight = Val(txtHeight.Text)
CWidth = Val(txtWidth.Text)
End Sub
well, the above is part of my project and i have a problem with that.
in frmCustom, i have 2 textboxes named "txtHeight" and "txtWidth" and i want to pass the values in "txtHeight" and "txtWidth" to frmMain. how can i get that?
-
March 31st, 2001, 10:26 AM
#2
Re: from one form to the other form
Declare the variables as Public in frmMain. Then you can access the variables from frmCustom as
FormName.VarName
I have modified your code to do the same.
'in frmMain
option Explicit
' Global variables hold the total number of columns and rows
public TotalCols as Integer
public TotalRows as Integer
private Sub Form_Load()
TotalCols = frmCustomField.CWidth
TotalRows = frmCustomField.CHeight
End Sub
--------------------------------------------------------------
' in frmCustom
option Explicit
private Sub cmdOk_Click()
Dim CHeight as Integer, CWidth as Integer
CHeight = Val(txtHeight.Text)
CWidth = Val(txtWidth.Text)
frmMain.TotalCols = CWidth
frmMain.TotalRows = CHeight
End Sub
-
March 31st, 2001, 10:43 AM
#3
Re: from one form to the other form
its still does not work..
-
March 31st, 2001, 06:35 PM
#4
Re: from one form to the other form
I had a similar problem just a little while ago, i wanted textbox's on the second form to display in the first form after clicking the ok button in the second form.
( i was going from the second form to the first, sounds like your just calling the second form )
What i had to do was call the name of the first form like this "fMainForm."
You are doing it differently so i don't know if that will help you but i think you have to name the form in full to get values from it (like a path statement).
-
March 31st, 2001, 07:20 PM
#5
Re: from one form to the other form
can u show me ur code so that i can try and figure it out...
-
April 1st, 2001, 06:50 AM
#6
Re: from one form to the other form
I dont have it on this computer, but see if this helps.
Change:
frmMain.TotalCols = CWidth
frmMain.TotalRows = CHeight
To:
fMainForm.TotalCols = CWidth
fMainForm.TotalRows = CHeight
See if that works in the mean time.
Did you start this project from the wizard? because if you did look in the module (top), there should be something in there that the wizard put in about nameing the form fMainForm, thats what had me stumped for a while.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|