Solved

Convert creatObject from VB to C# equivalent

Posted on 2011-03-20
4
491 Views
Last Modified: 2012-06-27
Hi Gents,

There is a line in VB that I can't seem to get working or a translation to work in C#. I'm really stuck any ideas?

Old VB code...
moAB = Microsoft.VisualBasic.Interaction.CreateObject("Broker.Application", "");

New C#?

Let me thank your efforts in advance.

Cheers - Sean
0
Comment
Question by:Dynotoe
  • 2
4 Comments
 
LVL 14

Accepted Solution

by:
brendanmeyer earned 250 total points
ID: 35176810
have a look at http://msdn.microsoft.com/en-us/library/system.activator.createinstance.aspx

http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/128e5981-35ce-436a-9323-e2fafdbecbbd/
Dim SomeObject As Object = System.Activator.CreateInstance(GetType(Button))
        // C# ?? >>
Object SomeOject = System.Activator.CreateInstance(GetType(Button));

Open in new window

0
 
LVL 29

Assisted Solution

by:anarki_jimbel
anarki_jimbel earned 250 total points
ID: 35176997
Yes, there is no analog for the function in C#. However, try this:

http://msmvps.com/blogs/pauldomag/archive/2006/03/15/86417.aspx

Also, have a  look:

http://msmvps.com/blogs/pauldomag/archive/2006/03/15/86417.aspx

Eventually, you may use this VB code in C#, just need to add a reference to Microsoft.VisualBasic ...
0
 

Author Comment

by:Dynotoe
ID: 35180603
Well, I'm totally stuck.  I  tried zip up and attached the project but it wouldn't let me on EE ...I would really appreciate anyone who can get it to build and run.  Run -- > Only so the window gui comes up.
I can email it to you.  Let me know.

There are only 11 build errors.  Remember this use to be in VB.

Best - Sean
0
 

Author Comment

by:Dynotoe
ID: 35180719
oh forgot...please help

seanpatrickoneill  aattee comcast.net
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
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…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
This video discusses moving either the default database or any database to a new volume.

705 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

23 Experts available now in Live!

Get 1:1 Help Now