Solved

How can I pass parameter values from function to function?

Posted on 2006-11-27
2
262 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 29

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

947 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now