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!

How can I close a form from another project??

Status
Not open for further replies.

ii128

Programmer
May 18, 2001
129
US
Hi, anyone can help me?? How can I close a form from another project??

I open a form1 from project 1. on the form1, it has a usercontrol. when I click on the usercontrol from project 1, it opens form2 from project 2. I want to close form1 when I updated the form2.

How can I do that???

 
Hi
I am not really sure about u r question:

try unload form1..and if u r creating forms at runtime use

set form=Nothing


Murali Bala
 
dont use modal

from the form1 call the form2 using FORM2.SHOW
and then from form2 control use the command UNLOAD FORM1

sample:
'***************************
'* This code goes to FORM 1
'***************************
Option Explicit

Private Sub Command1_Click()
Form2.Show 'Displays the form 2
End Sub


'***************************
'* This code goes to FORM 2
'***************************
Option Explicit

Private Sub Command1_Click()
Unload Form1 'Close the form 1
End Sub

 
Form1 is from project 1 and Form2 is from project 2, so I can't directly unload form1 or show Form2 because the software doesn't regonized.
 
You can always use a "flag". You can put a empty file or a "flag" in the registry with one form and with the other form, when you see the flag close it. It's not pretty but it will work.
 
well first in your first form you can create the file with the Open instruction
example :
Open "TESTFILE.TXT" For Input As #1
Close #1

this will create a file in your application folder that is named TESTFILE.TXT.(if you want it some ware else simply indicate the path first, example if you want your file in the root folder just type "C:\TESTFILE.TXT")

on your second form (in your other project) put a timer on it. Set the interval properties to the desired time interval.
In the event Timer, check for the file with the command Dir() -->> it return the name of the file if it find it or return empty if it doesn't find anything.
example :
if Dir(&quot;C:\FICHETEST.TXT&quot;) <> &quot;&quot; then
del(&quot;C:\FICHETEST.TXT&quot;)
end
endif

that should do the trick :)
good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top