Class in Dll

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • cvh

    Class in Dll

    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



  • Herfried K. Wagner [MVP]

    #2
    Re: Class in Dll

    "cvh" <Chris@nomail.c om> schrieb:[color=blue]
    > How can I create an instance of a class defined in a Dll?[/color]

    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/>

    Comment

    • Christophe

      #3
      Re: Class in Dll

      Thank you Herfried

      "Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
      news:uSWqHNBHFH A.576@TK2MSFTNG P15.phx.gbl...[color=blue]
      > "cvh" <Chris@nomail.c om> schrieb:[color=green]
      >> How can I create an instance of a class defined in a Dll?[/color]
      >
      > 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/>[/color]


      Comment

      • cvh

        #4
        Dependency error

        Hello,

        Now I'm getting this error:

        Error: The dependency 'mscorlib, Version=1.0.500 0.0, Culture=neutral ,
        PublicKeyToken= 969db8053d3322a c' in project 'SmartDeviceApp lication2' cannot
        be copied to the run directory because it would conflict with dependency
        'mscorlib, Version=1.0.500 0.0, Culture=neutral ,
        PublicKeyToken= b77a5c561934e08 9'.


        I need the Dll to function in CF, what do I need to change?

        Thank you,

        Christophe.

        "cvh" <Chris@nomail.c om> wrote in message
        news:OBKRyEBHFH A.3332@TK2MSFTN GP15.phx.gbl...[color=blue]
        > 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
        >
        >
        >[/color]


        Comment

        • cvh

          #5
          Re: Dependency error

          I had to compile the Dll with CF, now all is working.


          "cvh" <Chris@nomail.c om> wrote in message
          news:ORrxalXHFH A.2728@TK2MSFTN GP10.phx.gbl...[color=blue]
          > Hello,
          >
          > Now I'm getting this error:
          >
          > Error: The dependency 'mscorlib, Version=1.0.500 0.0, Culture=neutral ,
          > PublicKeyToken= 969db8053d3322a c' in project 'SmartDeviceApp lication2'
          > cannot be copied to the run directory because it would conflict with
          > dependency 'mscorlib, Version=1.0.500 0.0, Culture=neutral ,
          > PublicKeyToken= b77a5c561934e08 9'.
          >
          >
          > I need the Dll to function in CF, what do I need to change?
          >
          > Thank you,
          >
          > Christophe.
          >
          > "cvh" <Chris@nomail.c om> wrote in message
          > news:OBKRyEBHFH A.3332@TK2MSFTN GP15.phx.gbl...[color=green]
          >> 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
          >>
          >>
          >>[/color]
          >
          >[/color]


          Comment

          • cvh

            #6
            Re: Dependency error

            I had to compile the Dll with CF, now all is working.


            "cvh" <Chris@nomail.c om> wrote in message
            news:ORrxalXHFH A.2728@TK2MSFTN GP10.phx.gbl...[color=blue]
            > Hello,
            >
            > Now I'm getting this error:
            >
            > Error: The dependency 'mscorlib, Version=1.0.500 0.0, Culture=neutral ,
            > PublicKeyToken= 969db8053d3322a c' in project 'SmartDeviceApp lication2'
            > cannot be copied to the run directory because it would conflict with
            > dependency 'mscorlib, Version=1.0.500 0.0, Culture=neutral ,
            > PublicKeyToken= b77a5c561934e08 9'.
            >
            >
            > I need the Dll to function in CF, what do I need to change?
            >
            > Thank you,
            >
            > Christophe.
            >
            > "cvh" <Chris@nomail.c om> wrote in message
            > news:OBKRyEBHFH A.3332@TK2MSFTN GP15.phx.gbl...[color=green]
            >> 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
            >>
            >>
            >>[/color]
            >
            >[/color]


            Comment

            Working...