Solved

Convert creatObject from VB to C# equivalent

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

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 article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

820 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