i created 2 forms in a project. one form called frmMain and other is frmCustom.
form frmCustom have the textbox input for "height" and "width".how do i get the values from "height" and "width" in frmCustom to the other form "frmMain"?
Printable View
i created 2 forms in a project. one form called frmMain and other is frmCustom.
form frmCustom have the textbox input for "height" and "width".how do i get the values from "height" and "width" in frmCustom to the other form "frmMain"?
You can refer to any control of any loaded form by name thus:
public Sub CommandResize_Click()
me.Width = frmCustom.txtWidth.Text
End Sub
HTH,
Duncan
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
If I'm reading this correctly you are entering values in a textbox on one form and want to get those values to another form? You can either reference the first form frmMain.text1.text = frmCustom.text1.text or create a global variable in a module to capture the values on frmCustom and transfer them to frmMain as below:
In code module:
Public strHeight as String
Public strWidth as String
In frmCustom after entering value:
strHeight = text1.text
strWidth = text2.text
In frmMain:
text1.text = strHeight
text2.text = strWidth
hi,
thanks. by the way, you wrote:
In code module:
Public strHeight as String
Public strWidth as String
is it writting the above in the "standard module" .bas?
Yes. Put the variable declations in a bas module.
what is a bas module? i mean when should i use bas module and when i should i not use it?
Use a BAS module to declare ojects globally for use anywhere in your application. Just select Project|Add Module and save it as a .bas file.