Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2012-03-28
8
Medium Priority
?
356 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
[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
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

722 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