467,114 Members | 1,202 Online

# Adding a function to an interface????

 Hello everyone, I need your help, how could you add a function to an interface... i'll give you an example. i have to add a new public function to an interface that i have here called PaidHoliday Data type returned: Double and the parameters: CurrentYear Do i have to use an example of this : Function PaidHoliday (ByVal currentYear As Integer) As Double But how to finish it??? Thank you Nov 15 '06 #1
• viewed: 986
Share:
2 Replies
 100+ Hello everyone, I need your help, how could you add a function to an interface... i'll give you an example. i have to add a new public function to an interface that i have here called PaidHoliday Data type returned: Double and the parameters: CurrentYear Do i have to use an example of this : Function PaidHoliday (ByVal currentYear As Integer) As Double But how to finish it??? Thank you hi there note that you may only use the Public Statement in Modules ! otherwise change to private call your function as Answer=PaidHoliday(2006) , where Answer should be declared as double do some calculations is the function otherwise you won't get paid :) maybe add some Errortrap finish with End Function Nov 15 '06 #2
 1GB Hello everyone, I need your help, how could you add a function to an interface... i'll give you an example. i have to add a new public function to an interface that i have here called PaidHoliday Data type returned: Double and the parameters: CurrentYear Do i have to use an example of this : Function PaidHoliday (ByVal currentYear As Integer) As Double But how to finish it??? Thank you Hi. Here is an example; Expand|Select|Wrap|Line Numbers Dim dblResult As Double   dblResult = PaidHoliday(2005) 'dblResult is 25.3 dblResult = PaidHoliday(2002) 'dblResult is 22.6   Private Function PaidHoliday (ByVal currentYear As Integer) As Double    'do something here with currentYear eg    If currentYear = 2005 Then       PaidHoliday = 25.3    Else       PaidHoliday = 22.6    End If End Function   Nov 15 '06 #3