StrataFrame Forum
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



How to access other form's methods and...Expand / Collapse
Author
Message
Posted 08/02/2008 2:17:20 PM
Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Today @ 7:53:31 PM
Posts: 760, Visits: 3,283
Hi all,

I have an MDI parent form with some controls, I need to access another opened form's methods from the main form, but I don't know how.  I would need to test if that 2nd form is opened then call its methods and refresh it.  How can this be done? 

Please some sample code if possible.

Thanks!

 
Post #18274
Posted 08/02/2008 2:29:31 PM
Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Today @ 7:53:31 PM
Posts: 760, Visits: 3,283
Humm, I found a way to access the 2nd form's methods like this:

'-- Loop through all MDIChildren forms and when found the one we need,

'-- use CType() to get access to its custom public methods.

For Each loForm As Form In Me.MdiChildren

     If loForm.Name = "frmCallMonitor" Then

          CType(loForm, frmCallMonitor).CheckUncheckCallsInList()     ' This is a Public custom method in that form.

          Exit For

     End If

Next

So far this work, but I am not sure if there is a better way than looping all the MdiChildren collection.

 
Post #18275
Posted 08/03/2008 8:20:01 PM


StrataFrame Developer

StrataFrame Developer

Group: StrataFrame Developers
Last Login: Today @ 6:26:12 PM
Posts: 4,901, Visits: 4,887
I wouldn't use the name but rather test on the type:

If loForm.GetType() Is GetType(MyFormType) Then
   '---
End If

But other than that, the MDIChildren should work fine.

Post #18287
Posted 08/03/2008 8:51:02 PM
Advanced StrataFrame User

Advanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame UserAdvanced StrataFrame User

Group: StrataFrame Users
Last Login: Today @ 7:53:31 PM
Posts: 760, Visits: 3,283
Thanks Trent.

 
Post #18289
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Ben Chase, Trent L. Taylor, Steve L. Taylor

PermissionsExpand / Collapse

All times are GMT -6:00, Time now is 8:43pm

Powered by InstantForum.NET v4.1.4 © 2009
Execution: 0.125. 10 queries. Compression Enabled.
Site Map - Home - My Account - Forum - About Us - Contact Us - Try It - Buy It

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries.