Solved

Choose form at runtime

Posted on 2013-06-14
2
204 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 400 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 100 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

730 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