Solved

Convert creatObject from VB to C# equivalent

Posted on 2011-03-20
4
495 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

816 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

8 Experts available now in Live!

Get 1:1 Help Now