Re: Function scope in a class module
From: Ken Halter (Ken_Halter_at_Use_Sparingly_Hotmail.com)
Date: 09/14/04
- Next message: Alex: "Re: HELP!!! XML - Basic"
- Previous message: Gerald Hernandez: "Re: Intersecting Polygons"
- In reply to: Doug Donaldson: "Function scope in a class module"
- Next in thread: Doug Donaldson: "Re: Function scope in a class module"
- Reply: Doug Donaldson: "Re: Function scope in a class module"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 14 Sep 2004 12:50:51 -0700
Doug Donaldson wrote:
> Any suggestions?
adding to Tim's reply,
Thing is... you can have several instances of a class. That means you
need to be specific about the instance you're trying to use.
I'm not sure how your dll's put together but it probably starts with a
class that loads the forms. If you're not doing so already, those forms
should be created using object variables instead of writing something
like Form1.Show since there may be several instances of your main class
running as well.... anyway, your form needs a reference to the class you
want to use so you'll need something that looks a little like....
Private Sub Form_Load()
Dim o As Class1
Dim i As Integer
Set o = New Class1
i = o.TheNameOfYourFunction
Note that, if the name of your function doesn't show in intellisense
when you hit the period after the "o" above, there's a problem somewhere.
Also note that you should declare the function as Friend unless you plan
to use it from outside of the DLL. If you declare it Public, you won't
be able to change anything about its interface (name/args/etc) without
breaking Binary Compatibility... if you break, you'll have to rebuild
any apps that use the DLL.
-- Ken Halter - MS-MVP-VB - http://www.vbsight.com Please keep all discussions in the groups..
- Next message: Alex: "Re: HELP!!! XML - Basic"
- Previous message: Gerald Hernandez: "Re: Intersecting Polygons"
- In reply to: Doug Donaldson: "Function scope in a class module"
- Next in thread: Doug Donaldson: "Re: Function scope in a class module"
- Reply: Doug Donaldson: "Re: Function scope in a class module"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|