|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Private objects cannot be used ... as parameters.."Private object modules cannot be used in public object modules as parameters or ...etc" Given the desire to use an object as a parameter... Sub Main Dim oParam as cUsefulObject Set oParam = CreateParameterObject() Dim oSomeObj as cOtherObject Set oSomeObj = CreateOtherObject oSomeObj.Init(oParam) ... End Sub If cOtherObject.Init() is defined as Public Sub Init(oParam as cUsefulObject) ....then of course I get the compile error If cOtherObject.Init() is defined as Public Sub Init(oInParam as Object) Dim oParam as cUsefulObject Set oParam = oInParam ....then I can use it but it seems a weird workaround that the receiving object has to duplicate the dimming and setting .... but is that a "proper" way to get around the problem? ah..I just remembered the instancing properties of a class... so if this is a std exe project I can set the instancing of cUsefulObject to PublicNotCreatable and it would work...is that the better path? Thanks Mark Use "Friend" instead of "Public".
Private does not allow the method to be seen in the project nor outside the project. Friend allows the method to be seen in the project, but not outside the project. Public allows the method to be seen in the project and outside the project. Even though you maybe using a standard EXE, sometimes the compiler objects to using "Public", so use "Friend" instead.
Show quote
Hide quote
"Nobody" <nob***@nobody.com> wrote in message Thanks,news:uBuFp8$1JHA.3988@TK2MSFTNGP05.phx.gbl... > Use "Friend" instead of "Public". > > Private does not allow the method to be seen in the project nor outside the > project. > Friend allows the method to be seen in the project, but not outside the > project. > Public allows the method to be seen in the project and outside the project. > > Even though you maybe using a standard EXE, sometimes the compiler objects > to using "Public", so use "Friend" instead. > Have read about friend for years but never used it... will give it a go Mark
Contemplating the Migration
Control Focus Help using SendMessage() function can the loading of a large number of records go as quick as in DOS FMLabs FMTKit functions BigInteger and BigDecimal [equivalents] for VB.NET? Is using raw, uncooked Winsock so bad? NewEnum in Interface Font Scaling Enumerate Processes and Terminate Selected |
|||||||||||||||||||||||