Just make it the same as you did before only put it in the module with public 
scope. I realize that the code given to you had protected as its scope but here 
is a friendly tip for you:  If you get a message saying that a method or 
property can't be found then widen the scope.  It's telling you it can't "see" 
it - so you must be hiding it (there are other reasons like you spelled the 
name wrong, but scope is sometimes more difficult to understand as a possible 
problem if you aren't aware of it).  

Don't get hung up on the fact that the code provided has protected as the 
scope.  I'm sure Christian was just making an educated guess as to where this 
method would be called from...

Of course it's also dangerous to just go around widening the scope of 
everything. I'm just suggesting this as a way to diagnose and understand your 
code.  If it really should be protected then you will need to redesign your 
code.

~joe

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Lennox Jacob
Sent: Thursday, August 10, 2006 9:06 PM
To: Getting Started
Subject: RE: How can I simplify this code?

I was checking this

http://ramblings.aaronballman.com/?p=255

and it appears that i have to:

First, you make a new module. This is because all class extensions must be 
inside of modules and have global scope. The name of the module doesn’t 
matter, so I usually name it with the class I am extending, followed by 
Extensions. Then we’ll add two new public methods to the module.

I will need some help here in making this module.

Any suggestions.
Thanks.
Lennox.


Lennox Jacob <[EMAIL PROTECTED]> wrote: I did it exactly like that, protected:

Method Name    SetupColor
Parameters   Extends EF as EditField
Return type

The yellow triangle is selected
Protected Sub SetupColor((ExtendsEF as EditField)

EF1.SetupColor
This method or property does not exist.

Just can't get it to work.
Any more suggestions?

Thanks.
Lennox.

Joseph  wrote: You should stick with the first method if you created the method 
using
extends.  If the property "does not exist" then it may be a simple scoping
issue.  In other words you might want to make the method protected (just in
case you accidentally made it private) or even public depending upon where
you put the method or if it will be called from different locations.

~joe

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Lennox
Jacob
Sent: Thursday, August 10, 2006 7:47 PM
To: Getting Started
Subject: Re: How can I simplify this code?

Thanks Christian,

If I use it like this:
EF1.SetupColor
EF2.SetupColor
EF3.SetupColor
EF4.SetupColor
EF5.SetupColor
I get a compile error
This method or property does not exist    (SetupColor)


But if I call it like this

SetupColor(EF1)
SetupColor(EF2)
SetupColor(EF3)
SetupColor(EF4)
SetupColor(EF5)

Then I get a compile error
Only the first parameter may use the Extends option.

Kindly assist again.
Thanks 
Lennox

Christian Miller  wrote: -----BEGIN PGP SIGNED
MESSAGE-----
Hash: SHA1

On Aug 10, 2006, at 7:01 PM, Lennox Jacob wrote:
>   How can I simplify this code?

Protected Sub SetupColor(Extends EF as Editfield)
   If EF.text = ""  then
     EF.backcolor = &cDBDBDB
   else
     If val(EF.text) > 18 then
       EF.backcolor = &cFF8CC8
     else
       EF.backcolor = &cF9FFCF
     end if
   end if
End Sub


And then just call it:
EF1.SetupColor
EF2.SetupColor
EF3.SetupColor
EF4.SetupColor
EF5.SetupColor

Christian
Pariahware, Inc. Custom Software



- --
God loved you so much that He gave His only son Jesus.  What have you  
done with God's gift?



-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (Darwin)

iD8DBQFE28aUvplmRR9PMqERAhjZAJwPV4jbMk/U3ZSNvhD4cRSIQ79S7wCfWuXv
qRu/JM/4VyTtIApIZ5TobW8=
=yMn+
-----END PGP SIGNATURE-----
_______________________________________________
Unsubscribe or switch delivery mode:


Search the archives of this list here:




   
---------------------------------
Get your email and more, right on the  new Yahoo.com 
_______________________________________________
Unsubscribe or switch delivery mode:


Search the archives of this list here:


_______________________________________________
Unsubscribe or switch delivery mode:


Search the archives of this list here:



   
---------------------------------
Do you Yahoo!?
 Next-gen email? Have it all with the  all-new Yahoo! Mail Beta.
_______________________________________________
Unsubscribe or switch delivery mode:


Search the archives of this list here:



                
---------------------------------
Do you Yahoo!?
 Next-gen email? Have it all with the  all-new Yahoo! Mail Beta.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to