|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Why can't I test class functions from the Immediate window?have written. I created a new ActiveX DLL project. I created a Class module in that project. I copied 2-3 functions from another project into the class module. These are all Public functions. In the old project, the functions are in regular (.bas) module. There I am able to test them from the Immediate window. In the ActiveX project, I have the exact same functions defined, but when I type a test case in the Immediate window, I get a compile error: "Sub of Funtion not defined". Am I doing something wrong or is this how it's supposed to work? -- For email, use Usenet-20031220@spamex.com
http://emsindia.com/Hindi/H2/C854.html
http://www.webdevelopersjournal.com/articles/activex_for_asp.html Show quote Hide quote "LurfysMa" <invalid@invalid.invalid> wrote in message
news:pkoik193i6rak40g0uvhhljn2bsstbpg0d@4ax.com... > I am trying to create a DLL file for a bunch of utility functions I > have written. > > I created a new ActiveX DLL project. > I created a Class module in that project. > I copied 2-3 functions from another project into the class module. > These are all Public functions. > > In the old project, the functions are in regular (.bas) module. There > I am able to test them from the Immediate window. > > In the ActiveX project, I have the exact same functions defined, but > when I type a test case in the Immediate window, I get a compile > error: "Sub of Funtion not defined". > > Am I doing something wrong or is this how it's supposed to work? > > > > -- > For email, use Usenet-20031220@spamex.com Steve, I looked at the site you showed in your response to the question. I
would like to find the first page of these samples but if I try to use an address with a page lower than the first one shown I get a page not displayed. Do you known how I can find any pages lower than the ones shown(751)? Marv Show quoteHide quote "Steven Burn" <somewhere@in-time.invalid> wrote in message news:uoTH7pQzFHA.2848@TK2MSFTNGP15.phx.gbl... > http://emsindia.com/Hindi/H2/C854.html > http://www.webdevelopersjournal.com/articles/activex_for_asp.html > > -- > Regards > > Steven Burn > Ur I.T. Mate Group > www.it-mate.co.uk > > Keeping it FREE! > > "LurfysMa" <invalid@invalid.invalid> wrote in message > news:pkoik193i6rak40g0uvhhljn2bsstbpg0d@4ax.com... >> I am trying to create a DLL file for a bunch of utility functions I >> have written. >> >> I created a new ActiveX DLL project. >> I created a Class module in that project. >> I copied 2-3 functions from another project into the class module. >> These are all Public functions. >> >> In the old project, the functions are in regular (.bas) module. There >> I am able to test them from the Immediate window. >> >> In the ActiveX project, I have the exact same functions defined, but >> when I type a test case in the Immediate window, I get a compile >> error: "Sub of Funtion not defined". >> >> Am I doing something wrong or is this how it's supposed to work? >> >> >> >> -- >> For email, use Usenet-20031220@spamex.com > > The emsindia.com one only seem to have those linked on that page. However
WDJ's ASP article starting point is as; http://www.webdevelopersjournal.com/hubs/prophub.html#asp Show quoteHide quote "Marv Wade" <N*@columbus.rr.com> wrote in message news:O0aCW#QzFHA.3812@TK2MSFTNGP09.phx.gbl... > Steve, I looked at the site you showed in your response to the question. I > would like to find the first page of these samples but if I try to use an > address with a page lower than the first one shown I get a page not > displayed. > > Do you known how I can find any pages lower than the ones shown(751)? > > Marv > > "Steven Burn" <somewhere@in-time.invalid> wrote in message > news:uoTH7pQzFHA.2848@TK2MSFTNGP15.phx.gbl... > > http://emsindia.com/Hindi/H2/C854.html > > http://www.webdevelopersjournal.com/articles/activex_for_asp.html > > > > -- > > Regards > > > > Steven Burn > > Ur I.T. Mate Group > > www.it-mate.co.uk > > > > Keeping it FREE! > > > > "LurfysMa" <invalid@invalid.invalid> wrote in message > > news:pkoik193i6rak40g0uvhhljn2bsstbpg0d@4ax.com... > >> I am trying to create a DLL file for a bunch of utility functions I > >> have written. > >> > >> I created a new ActiveX DLL project. > >> I created a Class module in that project. > >> I copied 2-3 functions from another project into the class module. > >> These are all Public functions. > >> > >> In the old project, the functions are in regular (.bas) module. There > >> I am able to test them from the Immediate window. > >> > >> In the ActiveX project, I have the exact same functions defined, but > >> when I type a test case in the Immediate window, I get a compile > >> error: "Sub of Funtion not defined". > >> > >> Am I doing something wrong or is this how it's supposed to work? > >> > >> > >> > >> -- > >> For email, use Usenet-20031220@spamex.com > > > > > > On Sun, 9 Oct 2005 20:48:46 +0100, "Steven Burn"
<somewhere@in-time.invalid> wrote: That's essentially what I did the first time. As Mark pointed out, setting the Instancing property of the Class module to GlobalMultiUse eliminates the need for the Object variable and the Set statement. Right? -- For email, use Usenet-20031220@spamex.com
Show quote
Hide quote
"LurfysMa" <invalid@invalid.invalid> wrote in message Short answer is that's how it's supposed to work. Before you can use news:pkoik193i6rak40g0uvhhljn2bsstbpg0d@4ax.com... >I am trying to create a DLL file for a bunch of utility functions I > have written. > > I created a new ActiveX DLL project. > I created a Class module in that project. > I copied 2-3 functions from another project into the class module. > These are all Public functions. > > In the old project, the functions are in regular (.bas) module. There > I am able to test them from the Immediate window. > > In the ActiveX project, I have the exact same functions defined, but > when I type a test case in the Immediate window, I get a compile > error: "Sub of Funtion not defined". > > Am I doing something wrong or is this how it's supposed to work? anything in a class (property, method, etc.), you need to instantiate an object from that class. Unless you're running a project and have already instantiated an object, the Immediate window knows nothing about it (and even then, the object variable needs to be scope). -- Mike Microsoft MVP Visual Basic
Show quote
Hide quote
"MikeD" <nob***@nowhere.edu> wrote in message Of course if you want to have some ugly fun - you can instantiate the classnews:Oo4AJZSzFHA.2348@TK2MSFTNGP15.phx.gbl... > > "LurfysMa" <invalid@invalid.invalid> wrote in message > news:pkoik193i6rak40g0uvhhljn2bsstbpg0d@4ax.com... > >I am trying to create a DLL file for a bunch of utility functions I > > have written. > > > > I created a new ActiveX DLL project. > > I created a Class module in that project. > > I copied 2-3 functions from another project into the class module. > > These are all Public functions. > > > > In the old project, the functions are in regular (.bas) module. There > > I am able to test them from the Immediate window. > > > > In the ActiveX project, I have the exact same functions defined, but > > when I type a test case in the Immediate window, I get a compile > > error: "Sub of Funtion not defined". > > > > Am I doing something wrong or is this how it's supposed to work? > > > Short answer is that's how it's supposed to work. Before you can use > anything in a class (property, method, etc.), you need to instantiate an > object from that class. Unless you're running a project and have already > instantiated an object, the Immediate window knows nothing about it (and > even then, the object variable needs to be scope). > > > -- > Mike > Microsoft MVP Visual Basic > in the intermediate window. set a = new class1: ?a.method <g> -ralph "Ralph" <nt_consultin***@yahoo.com> wrote in message And that's about all the "fun" you'd have.news:UeadnVfYCJiDMdTenZ2dnUVZ_tGdnZ2d@arkansas.net... >> Short answer is that's how it's supposed to work. Before you can use >> anything in a class (property, method, etc.), you need to instantiate an >> object from that class. Unless you're running a project and have already >> instantiated an object, the Immediate window knows nothing about it (and >> even then, the object variable needs to be scope). > > Of course if you want to have some ugly fun - you can instantiate the > class > in the intermediate window. > set a = new class1: ?a.method BTW, I thought you were going to start "shortening" your quotes? <g> -- Mike Microsoft MVP Visual Basic
Show quote
Hide quote
"MikeD" <nob***@nowhere.edu> wrote in message Hey, that one was short. (short for me anyway.)news:OUZVE$SzFHA.2540@TK2MSFTNGP09.phx.gbl... > > "Ralph" <nt_consultin***@yahoo.com> wrote in message > news:UeadnVfYCJiDMdTenZ2dnUVZ_tGdnZ2d@arkansas.net... > > >> Short answer is that's how it's supposed to work. Before you can use > >> anything in a class (property, method, etc.), you need to instantiate an > >> object from that class. Unless you're running a project and have already > >> instantiated an object, the Immediate window knows nothing about it (and > >> even then, the object variable needs to be scope). > > > > Of course if you want to have some ugly fun - you can instantiate the > > class > > in the intermediate window. > > set a = new class1: ?a.method > > And that's about all the "fun" you'd have. > > BTW, I thought you were going to start "shortening" your quotes? <g> > > -- > Mike > Microsoft MVP Visual Basic > The others get a grace because it is Sunday. (Yes I play Calvin Ball a lot. <g>) -ralph
Show quote
Hide quote
"LurfysMa" <invalid@invalid.invalid> wrote in message "LurfysMa" -news:pkoik193i6rak40g0uvhhljn2bsstbpg0d@4ax.com... > I am trying to create a DLL file for a bunch of utility functions I > have written. > > I created a new ActiveX DLL project. > I created a Class module in that project. > I copied 2-3 functions from another project into the class module. > These are all Public functions. > > In the old project, the functions are in regular (.bas) module. There > I am able to test them from the Immediate window. > > In the ActiveX project, I have the exact same functions defined, but > when I type a test case in the Immediate window, I get a compile > error: "Sub of Funtion not defined". VB cannot find your procedures, because it isn't declared in public namespace. That is, you can only access a public procedure, function, or property in a standard BAS module, or from objects which have been mapped into global scope e.g. ActiveX DLLs with Global MultiUse classes or implicit Form objects. If you want to test the procedures in your class, you can add a new BAS module, and add a Property Get procedure named something appropriate, which returns an instance of the class you want to test, e.g. Class CGeneralProcedures ---------------------------------------- Public Sub DoSomething() ... End Sub Public Sub DoSomethingElse() ... End Sub Public Sub DoSomethingMore() ... End Sub Module MTest --------------------- Public Property Get GeneralProcedures() As CGeneralProcedures Set GeneralProcedures = New CGeneralProcedures End Property Immediate ======== GeneralProcedures.DoSomething GeneralProcedures.DoSomethingElse GeneralProcedures.DoSomethingMore -- Mark Bertenshaw Kingston upon Thames UK On Mon, 10 Oct 2005 00:20:27 +0100, "Mark Alexander Bertenshaw"
<mark.bertens***@virgin.net> wrote: Show quoteHide quote >"LurfysMa" <invalid@invalid.invalid> wrote in message Setting the Global Multiuse property solved most of the problems.>news:pkoik193i6rak40g0uvhhljn2bsstbpg0d@4ax.com... >> I am trying to create a DLL file for a bunch of utility functions I >> have written. >> >> I created a new ActiveX DLL project. >> I created a Class module in that project. >> I copied 2-3 functions from another project into the class module. >> These are all Public functions. >> >> In the old project, the functions are in regular (.bas) module. There >> I am able to test them from the Immediate window. >> >> In the ActiveX project, I have the exact same functions defined, but >> when I type a test case in the Immediate window, I get a compile >> error: "Sub of Funtion not defined". > >"LurfysMa" - > >VB cannot find your procedures, because it isn't declared in public >namespace. That is, you can only access a public procedure, function, or >property in a standard BAS module, or from objects which have been mapped >into global scope e.g. ActiveX DLLs with Global MultiUse classes or >implicit Form objects. Thanks for that suggestion. >If you want to test the procedures in your class, you can add a new BAS I'll check that out.>module, and add a Property Get procedure named something appropriate, which >returns an instance of the class you want to test, e.g. Show quoteHide quote >Class CGeneralProcedures >---------------------------------------- > >Public Sub DoSomething() > ... >End Sub > >Public Sub DoSomethingElse() > ... >End Sub > >Public Sub DoSomethingMore() > ... >End Sub > > >Module MTest >--------------------- > >Public Property Get GeneralProcedures() As CGeneralProcedures > Set GeneralProcedures = New CGeneralProcedures >End Property > > >Immediate >======== > >GeneralProcedures.DoSomething >GeneralProcedures.DoSomethingElse >GeneralProcedures.DoSomethingMore -- For email, use Usenet-20031220@spamex.com "LurfysMa" <invalid@invalid.invalid> wrote in message Just wait until you try to use the .Net immediate window.... LO<freaking>L news:pkoik193i6rak40g0uvhhljn2bsstbpg0d@4ax.com... > > In the old project, the functions are in regular (.bas) module. There > I am able to test them from the Immediate window. (some would say... what immediate window?) > In the ActiveX project, I have the exact same functions defined, but You have to create instances of any class modules you use... and, imo, the > when I type a test case in the Immediate window, I get a compile > error: "Sub of Funtion not defined". > > Am I doing something wrong or is this how it's supposed to work? ability to debug in the immediate window is not enough to get me to use GlobalMultiUse (memory leaks waiting to happen). Instead, create a Standard EXE test app to exercise the class. -- Ken Halter - MS-MVP-VB - http://www.vbsight.com DLL Hell problems? Try ComGuard - http://www.vbsight.com/ComGuard.htm Please keep all discussions in the groups..
.NOT My Views
Visual Basic 6.0 Working Model Reverse Array order ? Cannot Load Form! How should one form call another? advanced tooltip bubbles question How to handle data types in custom Max/Min function? Simulation! Point me in the right direction - Mouse utility... vbaccelerator - compile ListView for Unicode? |
|||||||||||||||||||||||