• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 171
  • Last Modified:

Passing a Procedure after creating a procedure

After creating an average function procedure that takes a decimal and return the results as a string how do I create another procedure that passes the decimal back to the average function
0
thimss2
Asked:
thimss2
  • 3
  • 2
1 Solution
 
CJ_SCommented:
You pass a decimal to average, and you need to pass the decimal back to average? Could you clarify what you want?
0
 
thimss2Author Commented:
I have created this functionn:
Public Function AWage(ByVal dWages as Decimal, By Val nEmpls as Integer) as String

Dim dWages as Decimal
Dim nEmpls as Integer


Return CStr(dWages/nEmpls)
End Function


Now I need to create a procedure that takes a decimal and integer and passes them to the Average function above

Thanks
0
 
CJ_SCommented:
Public Sub Average(ByVal dWages as Decimal, By Val nEmpls as Integer)
  AWage(dWages, nEmpls)
End Sub

?

0
 
thimss2Author Commented:
Re: I need to create a procedure that takes a decimal and integer and passes them to the Average function above
This is what I have come up with on my own.  I need some Feedback.

' called procedure which decides the passing mechanism
Sub DisplayInfo(AWage as string)
  Messagebox.Show(AWage)
End Sub

'calling procedure which passes the data into the average function above(AWage)
Sub avg1(dWages, nEmpls) Handles Button.Click1
  Dim V as string
  V= CSTR(dWages/ nEmpls)
DisplayInfo(V)
End Sub


0
 
CJ_SCommented:
Mm, you are a beginner :-)

I assume that you have a Button instance, and you would like the Average function to be called after a button has been pressed. Try it like:

Protected WithEVents Button1 as Button

' called procedure which decides the passing mechanism
Sub DisplayInfo(ByVal AWage as string)
  Messagebox.Show(AWage)
End Sub

'calling procedure which passes the data into the average function above(AWage)
Public Function Average(ByVal dWages as Decimal , ByVal nEmpls as ) as String
  Return (dWages/ nEmpls).ToString()
End Function

Private Sub Button1_OnClick(sender as Object, e as EventArgs) Handles Button1.Click
  DisplayInfo(Average(1.2, 4))
End Sub
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now