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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

calling other forms 2

Status
Not open for further replies.

poeijer

Programmer
May 29, 2002
69
NL
When i try to call another form from a form i use the formname.

this works in my develop environment but when i build it.
and try to run it through the exe i get an error:
object is not found..

what can this be? and how do i else call another form from one form? so adjust e.g. a value in a textbox from another form
anotherform.txtbox.value="test"
 
poeijer

Try this:
Code:
PUBLIC oForm1,oForm2
DO FORM myForm1.scx NAME oForm1
DO FORM myForm2.scx NAME oForm2

And now when you are in form2 you can call the textbox value of form1 :
Code:
oForm1.Text1.value

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first
 
HI Poeijer,


If you found any problem with Mike's suggestion, go to the following.

FOR I = 1 TO _SCREEN.FORMCOUNT
IF _SCREEN.FORMS(I).NAME = "Yourformname"
_SCREEN.FORMS(I).TEXT1.VALUE = "TEXT2"
ENDIF
ENDFOR

Anyhow you are not going to run more forms at a time, so the above method helps quickly.

Suggestions Invited...


gchandrujs [sunshine]

 
Just to give another viewpoint to think about, often you may not know if the form that you need to call a function on even exists, or if more than one of it exists.

For example, you may add a person to the database, and need to provoke any lists of people to refresh themselves to show the new addition... however, there may not even exist any forms that contain lists of people.

However, if it is your convention to always include a Logical property "ListenToMessages" and a method "GotMessage( pcMessage )", then it is simple to add a "SendMessage" method to your application object, which would use gchandrujs's method to scan the existing forms, see if they want to hear any messages, and give them the message "PERSON ADDED" or "PERSON CHANGED", etc.

(I actually use an object for the message, so in addition to the string description, I can include data properties that identify WHICH person was deleted or added, so that trees/lists don't have to update everything. In a multi user situation, you can have a message queue table and a listening timer watching the table to propogate messages into the application message queue from remote clients).

I'm sure this is overkill for your situation, but it it was already in place in your application, it would have accomplished this problem.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top