translate dll/tlb (for Excel as client) from VB.net to C#

R

Rich P

I created a library control in VB.Net some time ago for implementing
some .Net functionality for Excel as the client -- and made it com
visible. I want to redo this in C#. Additionally, I want to be able to
pass data to this control from Excel VBA. And lastly, I need to display
some results in a gui thing like a label or - ideally - just the user
control form

The following is the Interface part of my dll/tlb (I left out the guts
of the procedures). What is the C# syntax of this? Only need enough to
get me started

Imports System.Runtime.InteropServices
Imports System.Data.SqlClient
Imports System.Data.OleDb
Imports System.IO
Imports System.Data
Imports Microsoft.Office.Interop

<Guid("D621CC23-E6A3-4E41-A6A9-D1292DE9B728"), _
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _
Public Interface _IdataFromExcel
<DispId(1)> Sub ReadData_1()
<DispId(2)> Sub ReadData_2()
<DispId(3)> Sub ReadData_4()
<DispId(4)> Sub ReadData_4()
End Interface

<Guid("E8E11862-2FA7-4F5F-B2C8-D4072E2045B7"), _
ClassInterface(ClassInterfaceType.None), _
ProgId("myProj.clsDataFromExcel")> _
Public Class clsDataFromExcel
Implements _IdataFromExcel

Public Sub ReadData_1() Implements
_IdataFromExcel.ReadData_1
...
End Sub

Public Sub ReadData_2() Implements
_IdataFromExcel.ReadData_2
...
End Sub

Public Sub ReadData_3() Implements
_IdataFromExcel.ReadData_3
...
End Sub

Public Sub ReadData_4() Implements
_IdataFromExcel.ReadData_4
...
End Sub

End Class


For the libary part - obviously just change Imports to

using ...

---------------------------------

this following part is where I need to get it straight from VB to C#

<Guid("D621CC23-E6A3-4E41-A6A9-D1292DE9B728"), _
InterfaceType(ComInterfaceType.InterfaceIsIDispatch)> _
Public Interface _IdataFromExcel
<DispId(1)> Sub ReadData_1()
<DispId(2)> Sub ReadData_2()
<DispId(3)> Sub ReadData_4()
<DispId(4)> Sub ReadData_4()
End Interface

<Guid("E8E11862-2FA7-4F5F-B2C8-D4072E2045B7"), _
ClassInterface(ClassInterfaceType.None), _
ProgId("myProj.clsDataFromExcel")> _
Public Class clsDataFromExcel
Implements _IdataFromExcel

Public Sub ReadData_1() Implements
_IdataFromExcel.ReadData_1


And I am thinking I could just pass params to the routines directly for
reading data from the client (Excel)

public void ReadData_1(pass params here)
...

yes?

And I am assuming that I can compile a windows user control to a
dll/tlb?

Thanks

Rich
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top