New topic: 

Help Class  (Date)

<http://forums.realsoftware.com/viewtopic.php?t=38701>

         Page 1 of 1
   [ 4 posts ]                 Previous topic | Next topic          Author  
Message        jetpr          Post subject: Help Class  (Date)Posted: Wed Apr 
20, 2011 9:34 am                         
Joined: Wed Sep 20, 2006 5:12 pm
Posts: 264
Location: Puerto Rico                How i Add New Method to a Class

     
_________________
Thanks for any contribution  and  God blesses all (I start Using RS in 
10/12/2010)
 Mac Mini with Snow Leopard v10.6.7 and Real Studio 2011r1.1 Pro And Windows 
RS2011 Personal Register user 
   my Hobbies R/C Turbines Jets Models  
                             Top                 markwalsh          Post 
subject: Re: Help Class  (Date)Posted: Wed Apr 20, 2011 9:58 am                 
        
Joined: Wed May 20, 2009 4:43 pm
Posts: 450                jetpr wrote:How i Add New Method to a Class


Put this in a module:
Code:Function MyFunction(Extends d as Date) 
' ... code here
  End Function
      
_________________
RB 2009r4 Windows XP  
                             Top                 jetpr          Post subject: 
Re: Help Class  (Date)Posted: Wed Apr 20, 2011 10:13 am                         
Joined: Wed Sep 20, 2006 5:12 pm
Posts: 264
Location: Puerto Rico                but i have to return a value 

example:

Function DateDiff(fDate As String) As Integer
  Dim sReturn As Integer
  
  sReturn=10
  
  Return sReturn
End Function

but a have a error.

I need to now if i am doing this correct or is a Bug in RS 2011r1      
_________________
Thanks for any contribution  and  God blesses all (I start Using RS in 
10/12/2010)
 Mac Mini with Snow Leopard v10.6.7 and Real Studio 2011r1.1 Pro And Windows 
RS2011 Personal Register user 
   my Hobbies R/C Turbines Jets Models  
                             Top                 markwalsh          Post 
subject: Re: Help Class  (Date)Posted: Wed Apr 20, 2011 10:28 am                
         
Joined: Wed May 20, 2009 4:43 pm
Posts: 450                jetpr wrote:but i have to return a value 

example:

Function DateDiff(fDate As String) As Integer
  Dim sReturn As Integer
  
  sReturn=10
  
  Return sReturn
End Function

but a have a error.

I need to now if i am doing this correct or is a Bug in RS 2011r1
You can return a value from a class extension. But your function is not 
extending the Date class. You have to use the 'Extends' command for it to be 
added to the Date class. (I am assuming from your thread title that that is 
what you are trying to do)

Code:Function DateDiff(Extends d as date, fDate As String) As Integer
  Dim sReturn As Integer
  sReturn=10
  
  Return sReturn
End Function
      
_________________
RB 2009r4 Windows XP  
                             Top            Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 4 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to