dcsimg
Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Dec 5, 1997

WEBINAR:

On-Demand

Building the Right Environment to Support AI, Machine Learning and Deep Learning


Checking to see if a MDI Form is open

Question:
I have an MDI application; when I Unload one form I want to check to see if another form is open and if it is run some code that refreshes it. I've tried using
if frmname.visible=true 
to see if its open but this doesn't work (it loads up the form if it isn't open). How do I check to see if a form is open?

Answer:
If the target form is loaded, it will be included in the Forms collection. In the Unload event of the first form, call a RefreshForm procedure that loops through the Forms collection and looks for the desired form. If it's there, refresh it:

   Private Sub Form_Unload(Cancel As Integer)
       Call RefreshForm(frmOne)
   End Sub

   Public Sub RefreshForm(frmTarget As Form)

       Dim frm As Form

       For Each frm In Forms
           If frm Is frmTarget Then
               ' Call your refresh
               ' code here
           End If
       Next

   End Sub
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date