Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to return values from FORM?? 1

Status
Not open for further replies.

granni

Programmer
Nov 8, 2000
36
SG
I have a class that has a form variable, during runtime i open up this form and asks the user do a selection.

How do i return the selected value to the object that called it?

 
Declare a global variable and set it from within the form.
Note that the globals in the form will remain until you perform an unload on the form, so if you declare it there you may want to reset it before use.

-Mats
 
Thanks, but is there a way i can notify the calling object that the global variable in the form is changed?
 
Well, if you cant check for it in the calling function, then I guess that you will have to declare a public event and do a raiseevent from within the form when the value changes, but the easiest way would certainly be to check for changes in the variable after calling the form.

-Mats
 

Public Event EventName(fieldname As fieldtype)

Private Sub cmdOK_Click()

RaiseEvent EventName(txtFieldValue)
Unload Me

End Sub

Tarek

The more I learn, the more I need to learn!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top