?
Solved

Choose form at runtime

Posted on 2013-06-14
2
Medium Priority
?
207 Views
Last Modified: 2013-06-15
I need to choose at runtime which form I'll pass, but with this code gives me error "SaveDoc is not member of system.windows.forms"

Dim Myform as new Form
If Plataform = "MOB" Then
           myForm =  FrmDocMobile
Else
           myForm = FrmDoc
End If

       
If myForm.SaveDoc(TbImp) Then

......

end if
0
Comment
Question by:rflorencio
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 1600 total points
ID: 39247443
you need to create an interface (like IForm) that both frmDocMobile and frmDoc will implement. then you declare MyFrom as IForm and you will be able call the SaveDoc method.
0
 
LVL 86

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 400 total points
ID: 39247892
I like emoreau's answer and think that's the best approach.  You can also use Reflection to execute the method.  *If the method is Public then you can use the legacy CallByName() method.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

770 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