473,394 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

How to Call a Function as a argument in another Function

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
3 1008
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
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
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

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

Similar topics

9
by: Chuck Anderson | last post by:
I have a function with 7 inputs. The last three have default values. I want to call that function specifying the first four, skip two and then specify the last. I thought I could write this...
3
by: pytopo | last post by:
I like the way call tips displays argument variables for functions when you type the "(" after the function name. However, if one of the arguments to the function is something like...
4
by: mangi03 | last post by:
Hi, I came acrosss g++ compile errors whenever I make a function call by reference and found out from the test program that compiler is treating the function argument differently when another...
7
by: | last post by:
How to call a function with variable argument list from another function again with variable argument list? Example : double average ( int num, ... ); double AFunct1 ( int num, ... ); double...
39
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. ...
46
by: Steven T. Hatton | last post by:
I just read §2.11.3 of D&E, and I have to say, I'm quite puzzled by what it says. http://java.sun.com/docs/books/tutorial/essential/concurrency/syncrgb.html <shrug> -- NOUN:1. Money or...
1
by: Khai Doan | last post by:
I have function A, which need to call function B with the exact same argument list. What is the correct way to do this? I had function A: function A { B(arguments); } but it does not...
9
by: CryptiqueGuy | last post by:
Consider the variadic function with the following prototype: int foo(int num,...); Here 'num' specifies the number of arguments, and assume that all the arguments that should be passed to this...
12
by: Rahul | last post by:
Hi Everyone, I have the following code and i'm able to invoke the destructor explicitly but not the constructor. and i get a compile time error when i invoke the constructor, why is this so? ...
9
by: Yannick | last post by:
Hi everyone - I am not quite sure to understand what is really going on when a function defined in one translation unit calls a function defined in a different translation unit without knowing...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.