By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,868 Members | 1,765 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,868 IT Pros & Developers. It's quick & easy.

Class in Dll

P: n/a
cvh
How can I create an instance of a class defined in a Dll?

This is the code of the class:

Class PrClass

Public aPrNummer As Integer
Public aPrBarcode As String
Public aPrPma As Integer
Public aPrVaMaNr As Integer
Public aPrToMaNr As Integer

Sub New(ByVal Prnummer As Integer, ByVal PrBarcode As String, ByVal
PrPma As Integer, _
ByVal PrVaMaNr As Integer, ByVal PrToMaNr As Integer)

aPrNummer = Prnummer
aPrBarcode = PrBarcode
aPrPma = PrPma
aPrVaMaNr = PrVaMaNr
aPrToMaNr = PrToMaNr

End Sub

Public Overrides Function ToString() As String

Return CStr(aPrNummer) + _
";" + aPrBarcode + _
";" + CStr(aPrPma) + _
";" + CStr(aPrVaMaNr) + _
";" + CStr(aPrToMaNr) + _
";"
End Function
End Class
TIA,

Christophe

Nov 21 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
"cvh" <Ch***@nomail.com> schrieb:
How can I create an instance of a class defined in a Dll?


Select and right-click the EXe project in the solution explorer and choose
"Add reference..." from the context menu. If the DLL project is part of the
same solution, add a project reference, otherwise add a reference to the DLL
file. Then import the DLL's namespace and use the class.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #2

P: n/a
Thank you Herfried

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uS*************@TK2MSFTNGP15.phx.gbl...
"cvh" <Ch***@nomail.com> schrieb:
How can I create an instance of a class defined in a Dll?


Select and right-click the EXe project in the solution explorer and choose
"Add reference..." from the context menu. If the DLL project is part of
the same solution, add a project reference, otherwise add a reference to
the DLL file. Then import the DLL's namespace and use the class.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3

P: n/a
cvh
Hello,

Now I'm getting this error:

Error: The dependency 'mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=969db8053d3322ac' in project 'SmartDeviceApplication2' cannot
be copied to the run directory because it would conflict with dependency
'mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'.
I need the Dll to function in CF, what do I need to change?

Thank you,

Christophe.

"cvh" <Ch***@nomail.com> wrote in message
news:OB**************@TK2MSFTNGP15.phx.gbl...
How can I create an instance of a class defined in a Dll?

This is the code of the class:

Class PrClass

Public aPrNummer As Integer
Public aPrBarcode As String
Public aPrPma As Integer
Public aPrVaMaNr As Integer
Public aPrToMaNr As Integer

Sub New(ByVal Prnummer As Integer, ByVal PrBarcode As String, ByVal
PrPma As Integer, _
ByVal PrVaMaNr As Integer, ByVal PrToMaNr As Integer)

aPrNummer = Prnummer
aPrBarcode = PrBarcode
aPrPma = PrPma
aPrVaMaNr = PrVaMaNr
aPrToMaNr = PrToMaNr

End Sub

Public Overrides Function ToString() As String

Return CStr(aPrNummer) + _
";" + aPrBarcode + _
";" + CStr(aPrPma) + _
";" + CStr(aPrVaMaNr) + _
";" + CStr(aPrToMaNr) + _
";"
End Function
End Class
TIA,

Christophe

Nov 21 '05 #4

P: n/a
cvh
I had to compile the Dll with CF, now all is working.
"cvh" <Ch***@nomail.com> wrote in message
news:OR**************@TK2MSFTNGP10.phx.gbl...
Hello,

Now I'm getting this error:

Error: The dependency 'mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=969db8053d3322ac' in project 'SmartDeviceApplication2'
cannot be copied to the run directory because it would conflict with
dependency 'mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'.
I need the Dll to function in CF, what do I need to change?

Thank you,

Christophe.

"cvh" <Ch***@nomail.com> wrote in message
news:OB**************@TK2MSFTNGP15.phx.gbl...
How can I create an instance of a class defined in a Dll?

This is the code of the class:

Class PrClass

Public aPrNummer As Integer
Public aPrBarcode As String
Public aPrPma As Integer
Public aPrVaMaNr As Integer
Public aPrToMaNr As Integer

Sub New(ByVal Prnummer As Integer, ByVal PrBarcode As String, ByVal
PrPma As Integer, _
ByVal PrVaMaNr As Integer, ByVal PrToMaNr As Integer)

aPrNummer = Prnummer
aPrBarcode = PrBarcode
aPrPma = PrPma
aPrVaMaNr = PrVaMaNr
aPrToMaNr = PrToMaNr

End Sub

Public Overrides Function ToString() As String

Return CStr(aPrNummer) + _
";" + aPrBarcode + _
";" + CStr(aPrPma) + _
";" + CStr(aPrVaMaNr) + _
";" + CStr(aPrToMaNr) + _
";"
End Function
End Class
TIA,

Christophe


Nov 21 '05 #5

P: n/a
cvh
I had to compile the Dll with CF, now all is working.
"cvh" <Ch***@nomail.com> wrote in message
news:OR**************@TK2MSFTNGP10.phx.gbl...
Hello,

Now I'm getting this error:

Error: The dependency 'mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=969db8053d3322ac' in project 'SmartDeviceApplication2'
cannot be copied to the run directory because it would conflict with
dependency 'mscorlib, Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089'.
I need the Dll to function in CF, what do I need to change?

Thank you,

Christophe.

"cvh" <Ch***@nomail.com> wrote in message
news:OB**************@TK2MSFTNGP15.phx.gbl...
How can I create an instance of a class defined in a Dll?

This is the code of the class:

Class PrClass

Public aPrNummer As Integer
Public aPrBarcode As String
Public aPrPma As Integer
Public aPrVaMaNr As Integer
Public aPrToMaNr As Integer

Sub New(ByVal Prnummer As Integer, ByVal PrBarcode As String, ByVal
PrPma As Integer, _
ByVal PrVaMaNr As Integer, ByVal PrToMaNr As Integer)

aPrNummer = Prnummer
aPrBarcode = PrBarcode
aPrPma = PrPma
aPrVaMaNr = PrVaMaNr
aPrToMaNr = PrToMaNr

End Sub

Public Overrides Function ToString() As String

Return CStr(aPrNummer) + _
";" + aPrBarcode + _
";" + CStr(aPrPma) + _
";" + CStr(aPrVaMaNr) + _
";" + CStr(aPrToMaNr) + _
";"
End Function
End Class
TIA,

Christophe


Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.