Click here to Skip to main content
15,896,497 members
Home / Discussions / C#
   

C#

 
GeneralPlease disregard the previous exception in the previous message Pin
Albert8324-Jan-06 20:01
Albert8324-Jan-06 20:01 
GeneralRe: Please disregard the previous exception in the previous message Pin
Garry Stewart24-Jan-06 21:07
Garry Stewart24-Jan-06 21:07 
GeneralRe: Please disregard the previous exception in the previous message Pin
Albert8325-Jan-06 15:11
Albert8325-Jan-06 15:11 
GeneralRe: Can't make array class data shown in a label Pin
Albert8325-Jan-06 16:30
Albert8325-Jan-06 16:30 
GeneralRe: Can't make array class data shown in a label Pin
Garry Stewart25-Jan-06 16:39
Garry Stewart25-Jan-06 16:39 
GeneralRe: Can't make array class data shown in a label Pin
Albert8325-Jan-06 16:39
Albert8325-Jan-06 16:39 
GeneralRe: Can't make array class data shown in a label Pin
Albert8325-Jan-06 16:48
Albert8325-Jan-06 16:48 
GeneralRe: Can't make array class data shown in a label Pin
Garry Stewart25-Jan-06 16:59
Garry Stewart25-Jan-06 16:59 
You just want ToString to return a string for that current element. You don't want it to create an array or anything like that.

I've modified your code as an example:

public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.ComponentModel.Container components = null;

public Form1()
{
InitializeComponent();

Person[] arr = new Person[2];
arr[0] = new Person(12, 3.3, 3.3, "test", 3.3, 3.3);
arr[1] = new Person(15, 3.3, 3.3, "test", 3.3, 3.3);

this.label1.Text = "";

for (int i = 0; i < arr.Length; i++)
{
this.label1.Text += arr[i].ToString();
}
}
}
public class Person
{
public int age;
public double height;
public double weight;
public string bankName;
public double bankAccount;
public double balance;

public Person(int age, double height, double weight, string bankName, double bankAccount, double balance)
{
this.age = age;
this.height = height;
this.weight = weight;
this.bankName = bankName;
this.bankAccount = bankAccount;
this.balance = balance;
}
public override string ToString()
{
return this.Age;
}
}
GeneralRe: Can't make array class data shown in a label Pin
Albert8325-Jan-06 17:19
Albert8325-Jan-06 17:19 
Questioncopy Pin
quarinteen23-Jan-06 14:49
quarinteen23-Jan-06 14:49 
AnswerRe: copy Pin
Dave Kreskowiak23-Jan-06 15:32
mveDave Kreskowiak23-Jan-06 15:32 
QuestionPlease Solve with me this network Problem Pin
snouto23-Jan-06 12:50
snouto23-Jan-06 12:50 
AnswerRe: Please Solve with me this network Problem Pin
Dave Kreskowiak23-Jan-06 15:28
mveDave Kreskowiak23-Jan-06 15:28 
AnswerRe: Please Solve with me this network Problem Pin
Garry Stewart23-Jan-06 20:35
Garry Stewart23-Jan-06 20:35 
Questioninvoke codefile from a path embedded in XML? Pin
mattica23-Jan-06 12:19
mattica23-Jan-06 12:19 
AnswerRe: invoke codefile from a path embedded in XML? Pin
snouto23-Jan-06 12:56
snouto23-Jan-06 12:56 
GeneralRe: invoke codefile from a path embedded in XML? Pin
mattica23-Jan-06 18:15
mattica23-Jan-06 18:15 
GeneralRe: invoke codefile from a path embedded in XML? Pin
lmoelleb23-Jan-06 21:32
lmoelleb23-Jan-06 21:32 
Questionkeyboard sequence Pin
quasi478523-Jan-06 11:54
quasi478523-Jan-06 11:54 
QuestionTurn of word wrapping on labels Pin
dbrenth23-Jan-06 10:52
dbrenth23-Jan-06 10:52 
AnswerRe: Turn of word wrapping on labels Pin
tarasn23-Jan-06 11:42
tarasn23-Jan-06 11:42 
AnswerRe: Turn of word wrapping on labels Pin
microsoc23-Jan-06 15:15
microsoc23-Jan-06 15:15 
AnswerRe: Turn of word wrapping on labels Pin
Dan Neely24-Jan-06 2:08
Dan Neely24-Jan-06 2:08 
GeneralRe: Turn of word wrapping on labels Pin
dbrenth24-Jan-06 5:29
dbrenth24-Jan-06 5:29 
Questionclass question Pin
Manu_8123-Jan-06 10:44
Manu_8123-Jan-06 10:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.