Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Check if object is loaded.

Posted on 2003-02-27
4
Medium Priority
?
153 Views
Last Modified: 2012-05-05
Is there a function or any way to check if a form is loaded? For example, I want to set the TextBox on a form to "Hello World", but only if that form is already loaded. If I call anything on the form, like .Visible, it loads the form. I'm looking for something like a

IsLoaded(frmCheck as Form) as Boolean

Anyone know of a way I could do this? or a function that already exists? I'd prefer not to set Global flags for every form I want to do this on.
0
Comment
Question by:dankennedy
  • 2
4 Comments
 
LVL 1

Expert Comment

by:magglass1
ID: 8035175
Can you not use Load()?

Ex:
Private Sub Form1_Load()

End Sub
0
 
LVL 2

Author Comment

by:dankennedy
ID: 8035213
Oh sorry. I don't think my question made sense. I actually want to check if a form is loaded from another form. Like, in form1 I want to say IsLoaded(form2).
0
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 300 total points
ID: 8035221
try something along these lines:

Private Function IsLoaded(frmCheck as Form) as Boolean
   dim blnResult as Boolean
   Dim frm as Form
   for each frm in Forms
     if frm.Name = frmCheck.Name then
        blnResult = True
        Exit For
     end if
   Next
   IsLoaded = blnResult
end Function


this should get you what you need.

AW
0
 
LVL 2

Author Comment

by:dankennedy
ID: 8035372
Yes... exactly what I want. Thanks.
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month13 days, 21 hours left to enroll

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question