Results 1 to 7 of 7

Thread: VB.NET Dlls - Passing a form as an argument [Resolved]

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Belfast, N. Ireland
    Posts
    167

    VB.NET Dlls - Passing a form as an argument [Resolved]

    Hello,

    I've finally decided to begin exploring .NET and have begun
    experimenting with a little program with a plug-in style architecture.
    I have a plug-in dll which uses an interface dll to pass arguments to
    a host exe.

    I can pass strings and simple types like that, but say for example I
    would like to pass a form (from the plug-in dll) as an argument to the
    host exe (which isn't aware of the form class type in the plug-in),
    and then manipulate the form from within the host exe?

    If anyone has any insight, or links to articles or tutorials, that
    would be a great help.

    Thanks!

    Justin.
    Last edited by Justy; Jul 25th, 2003 at 09:27 AM.

  2. #2
    Addicted Member PeteD's Avatar
    Join Date
    Jun 2003
    Location
    Sydney
    Posts
    158
    just pass the form object as an argument of type Windows.Forms.Form

  3. #3
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    just make sure you make the parameter ByRef too.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Belfast, N. Ireland
    Posts
    167
    Thanks folks,

    I'm getting "Option Strict disallows implicit conversions from System.Windows.Forms.Form to PluginSample.Plugin.Form1"

    It's very head scratching learning stuff from scratch again... in VB, you'd have declared the argument as type Form and bobs your uncle!

  5. #5
    Addicted Member PeteD's Avatar
    Join Date
    Jun 2003
    Location
    Sydney
    Posts
    158
    Originally posted by Justy
    Thanks folks,

    I'm getting "Option Strict disallows implicit conversions from System.Windows.Forms.Form to PluginSample.Plugin.Form1"

    It's very head scratching learning stuff from scratch again... in VB, you'd have declared the argument as type Form and bobs your uncle!
    use CType

    yourForm1 = Ctype(yourForm1Arg, PluginSample.Plugin.Form1)

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Aug 2002
    Location
    Belfast, N. Ireland
    Posts
    167
    Simple as that! It's working now...

    Thanks a lot.

  7. #7
    Addicted Member PeteD's Avatar
    Join Date
    Jun 2003
    Location
    Sydney
    Posts
    158
    pleasure..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width