Solved

Convert creatObject from VB to C# equivalent

Posted on 2011-03-20
4
503 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
[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
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 30

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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

623 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