468,765 Members | 1,471 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,765 developers. It's quick & easy.

arrays from other functions

I'm stuck with trying to reference an array of datagridviews that i
created at runtime. It works fine when I reference them within the
function they were created, but now I want to refer to them in another
function. They are both public functions so I just was wondering what
I need to do to access this array (or any variable for that matter) in
another function without creating it outside of the first function.
DataGridView[] Tools = new DataGridView[nToolChangeCalls];

Mar 22 '07 #1
1 1018
On Mar 22, 11:10 am, r...@uni.edu wrote:
I'm stuck with trying to reference an array of datagridviews that i
created at runtime. It works fine when I reference them within the
function they were created, but now I want to refer to them in another
function. They are both public functions so I just was wondering what
I need to do to access this array (or any variable for that matter) in
another function without creating it outside of the first function.
DataGridView[] Tools = new DataGridView[nToolChangeCalls];
There are two basic ways to share data between two functions:
1) pass the data from the first function to the second as an argument
2) keep a reference to the data in a mutually accessible store e.g. if
they are both public methods in the same class, keep a private field
that they both use

Mar 22 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by csx | last post: by
34 posts views Thread by Christopher Benson-Manica | last post: by
7 posts views Thread by Kieran Simkin | last post: by
3 posts views Thread by Randy Yates | last post: by
6 posts views Thread by Michael Gray | last post: by
60 posts views Thread by Peter Olcott | last post: by
weaknessforcats
29 posts views Thread by weaknessforcats | last post: by
127 posts views Thread by sanjay.vasudevan | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by Marin | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.