Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Vb.net to C# conversion (late binding problem)

Posted on 2012-03-28
8
Medium Priority
?
362 Views
Last Modified: 2012-06-27
Hi ,

I need the convert the attach module in C#.

The problem is only the 'late binding'.

There is a way to solve this problem ?

Thank You !
ModuloWord.txt
0
Comment
Question by:luca345
  • 4
  • 4
8 Comments
 
LVL 20

Expert Comment

by:BuggyCoder
ID: 37776721
can you highlight the section where there is problem???
0
 

Author Comment

by:luca345
ID: 37776764
The atteched module works 100% but I need to convert it in C#.

The problem is

//
1:      ObjWord = CreateObject("Word.Application")
//

and then this:

//
 Public Sub Word_Open(ByRef ObjWord As Object, ByVal FileInput As String)
//

C# don't support  'late binding'.


//  

 Public Sub Word_Open(ByRef ObjWord As Object, ByVal FileInput As String)

        '/////////////////////////////////////////////////////////////
        '/////////// Create Word object and open the file ////////////
        '/////////////////////////////////////////////////////////////

1:      ObjWord = CreateObject("Word.Application")

        ObjWord.Documents.Open(FileInput)

    End Sub

//
0
 
LVL 20

Expert Comment

by:BuggyCoder
ID: 37776787
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:luca345
ID: 37776805
Hi BuggyCoder,

Convert a code is not a problem.

Here there is a concept that is different from VB.net and C#.

There is not automatic converted that can solve the problem, only a human can solve this.
0
 
LVL 20

Expert Comment

by:BuggyCoder
ID: 37776871
well in c# you can use System.VisualBasic namespace and call
var objWord = Interaction.CreateObject("Word.Application") as Word.Application;

see this for reference:-
http://www.c-sharpcorner.com/UploadFile/amrish_deep/WordAutomation05102007223934PM/WordAutomation.aspx
0
 

Author Comment

by:luca345
ID: 37776910
Yes teorically is possible but I like to programmin in C# and I don't want use a VB reference.

And apart this when I will try do import it in monoproject vb 'createobject' is not supported.
0
 
LVL 20

Accepted Solution

by:
BuggyCoder earned 2000 total points
ID: 37776927
the link that i post in my previous post, tells you how to open word doc from a c# application.
Try to follow and see if it helps....
0
 

Author Closing Comment

by:luca345
ID: 37776964
Thank you !
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Loops Section Overview
Suggested Courses

916 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