i want get multiple values if i call i method.

example:

_____________________________________________
public void setData(int age, string name, string address){}

______________________________________________
Data data = new Data();
data.setData(age, name, address);
______________________________________________

when setData() are excuted he doesn't return the parameters with the values.

what can i do?

Recommended Answers

All 2 Replies

In your setData you could simply change public properties and then access it from the other class.

public class Data
{
private int _age = 0;
public int Age { get { return _age; } set { _age = value; } }

public void setData(int age, string name, string address)
{
//ill just do age for the example
     _age = age;
}
}

in your other class (mainform for example)

//in some method
Data d = new Data();
data.setData(age, name, address);

//after you can access or change with
int temp = data.Age;

thank you PierlucSS !!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.