I want to call and send a parameter to a form
because normally a form have no parameters
How can I modify a form so it can accept a parameter ?
Printable View
I want to call and send a parameter to a form
because normally a form have no parameters
How can I modify a form so it can accept a parameter ?
Privida, the easier way is declare a public/global variable. Set the data into this variable before you load the form.
In the form, then you juz read the data from this variable will do.
As myself also wanna to know how to make a form to accept parameter passing.
:)
I have always used private member variables in the form and then written a new function like show2 in the form
i.e. code for form
Option Explicit
Private m_sMyString as String
Public Sub Show2(ByVal sParam as String)
m_sMyString = sParam
Me.Show
End Sub
Thank's a lot
Btw, I want to know if I can use API function to do that ?
I just always use Public varables on the form for the pieces I was to use. that way I initalize them before I show the form and then use the normal event structure. You can also use this to pass data back to the calling process.
PUBLIC sPassedName as String
Private Sub Form_Load()
if (me.sPassedname = "Babelfish") then
Msgbox "You are awsome!!!"
Endif
End Sub
public sub Main()
form1.sPassedName = "Babelfish"
form1.show vbmodal
end sub
-- Why would you want to do that with an API? Just Wondering.
babelfish.
[email protected]