Solved

Choose form at runtime

Posted on 2013-06-14
2
200 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
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 85

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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 …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This is a video that shows how the OnPage alerts system integrates into ConnectWise, how a trigger is set, how a page is sent via the trigger, and how the SENT, DELIVERED, READ & REPLIED receipts get entered into the internal tab of the ConnectWise …

932 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

10 Experts available now in Live!

Get 1:1 Help Now