By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,792 Members | 1,306 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,792 IT Pros & Developers. It's quick & easy.

How to Call a Function as a argument in another Function

P: 2
I am using Visual Studio and using this code in report Properties

Expand|Select|Wrap|Line Numbers
  1. Dim values As New System.Collection.ArrayList
  2.  
  3. Function AddValues(newValue As Decimal) As Decimal
  4. values.Add(newValues)
  5. AddValues=newValues
  6. End Function
  7.  
  8. Function GetMedian() As Decimal
  9. Dim count As Integer =values.Count
  10. If (count>0)
  11. values.Sort()
  12. GetMedian=values(count\2)
  13. End If
  14. End Function

I am new to Function and i want 2 changes in this code
1) i want to use newValue as Array in function AddValue
2) i want to call AddValue in GetMedian Function as Argument
because i want to calulate medians of list of arrays which are grouped in AddValue Function
or
tell me something to use by which i can group the (values)* by the field i want

i hope you undertood what i am saying....Please help me with this
i need to solve this urgent
Thanks in advance
Vijeta
Mar 28 '07 #1
Share this Question
Share on Google+
3 Replies


P: 27
correct me if i was wrong

if you want to pass an array to a function your function structure should be


public sub somthing(_values as string())
//operation
end sub

if your function must return the values then

public function somthing(_values as string()) as string()
//operation
return _values()
end sub
Mar 28 '07 #2

P: 2
correct me if i was wrong

if you want to pass an array to a function your function structure should be


public sub somthing(_values as string())
//operation
end sub

if your function must return the values then

public function somthing(_values as string()) as string()
//operation
return _values()
end sub
thanks for you reply i try apply this on my code hope it will work
Mar 29 '07 #3

P: 27
sorry there was a mistake on the second to the last line... the return should be _values with out parenthesis...

public sub somthing(_values as string())
//operation
end sub

if your function must return the values then

public function somthing(_values as string()) as string()
//operation
return _values
end sub
Apr 6 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.