Solved

How can I pass parameter values from function to function?

Posted on 2006-11-27
2
265 Views
Last Modified: 2010-04-16
Hi,

As what I state in the title, I want to know how can I pass parameter values...
Here is what I have in my codes...

public struct TypeA
{
 string name;
 int value;
}
public void Function123(int paramA, TypeA paramB)
{
 // here I try to get paramA and paramB values
}

public void Main
{
  TypeA target;
  int index;

  Function123(index, target);   <-- here I try to get values from this function but the values seem not passed through the function
}

How exactly I should do to pass parameter values??
0
Comment
Question by:xenia27
2 Comments
 
LVL 30

Accepted Solution

by:
anarki_jimbel earned 500 total points
ID: 18025383
Not exactly clear what you are trying to achieve.

First, your variables are not initialized.
To pass your values to the function you need to create new struct instance and initialize integer.

If you are going to change your variables inside the function and want to see the changes afteryour  function invocation
you may use passing parameters by reference. However you need to declare your function appropriately;

        public void Function123(ref int paramA, ref TypeA paramB)
        {
            // here I try to get paramA and paramB values
        }

and in Main you invoke:

Function123(ref index, ref target);
0
 

Author Comment

by:xenia27
ID: 18026046
this is exactly what I try to figure out..thanks~
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question