Solved

Choose form at runtime

Posted on 2013-06-14
2
199 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
2 Comments
 
LVL 69

Accepted Solution

by:
Éric Moreau earned 400 total points
Comment Utility
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 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 100 total points
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

744 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now