Click here to Skip to main content
15,897,187 members
Home / Discussions / C#
   

C#

 
GeneralRe: Can't make array class data shown in a label Pin
AB777124-Jan-06 20:54
AB777124-Jan-06 20:54 
GeneralRe: Can't make array class data shown in a label Pin
Guffa23-Jan-06 20:41
Guffa23-Jan-06 20:41 
GeneralRe: Can't make array class data shown in a label Pin
Albert8324-Jan-06 9:41
Albert8324-Jan-06 9:41 
AnswerRe: Can't make array class data shown in a label Pin
Garry Stewart23-Jan-06 21:21
Garry Stewart23-Jan-06 21:21 
GeneralRe: Can't make array class data shown in a label Pin
Albert8324-Jan-06 9:51
Albert8324-Jan-06 9:51 
GeneralRe: Can't make array class data shown in a label Pin
Garry Stewart24-Jan-06 12:54
Garry Stewart24-Jan-06 12:54 
GeneralRe: Can't make array class data shown in a label Pin
Albert8324-Jan-06 19:32
Albert8324-Jan-06 19:32 
GeneralPlease disregard the previous exception in the previous message Pin
Albert8324-Jan-06 20:01
Albert8324-Jan-06 20:01 
Now I see the following text in the label: windowsPracticingWithClasses.Athlete, Text: PersonwindowsPracticingWithClasses.Athlete, Text:
PersonwindowsPracticingWithClasses.Athlete, Text:
Person

Do you know what that might mean?

Person is the class name, as well as Athlete, windowsPracticingWithClasses is a namespace. The word "Text" repeats 3 times. And I have 3 elements in the array: Person[] athlete = new Athlete[3]; All 3 are populated.

Just changed the code to this:
for (int i = 0; i < athlete.Length; i++)
label1.Text += athlete[i].Text.ToString();

And now I see "PersonPersonPerson" in the label.

The same happens when I write
label1.Text += athlete[i].Text;

Here is the relevant code again:
Thanks again.

private void Person_Load(object sender, System.EventArgs e)
{
this.label1.Text = "";

Person[] athlete = new Athlete[3];

athlete[0] = new Athlete("Figure Skating");
athlete[0].FirstName = "Sarah";
athlete[0].LastName = "Hughes";
athlete[0].Age = 20;
athlete[0].Height1 = 5.5;
athlete[0].Weight = 120;
athlete[0].BankName = "Chase";
athlete[0].BankAccount = 434324;
athlete[0].Balance = 200;

athlete[1] = new Athlete("Martial Arts");
athlete[1].FirstName = "Kim";
athlete[1].LastName = "Chung";
athlete[1].Age = 21;
athlete[1].Height1 = 5.7;
athlete[1].Weight = 130;
athlete[1].BankName = "Citi";
athlete[1].BankAccount = 212312;
athlete[1].Balance = 300;

athlete[2] = new Athlete("Soccer");
athlete[2].FirstName = "Joe";
athlete[2].LastName = "Tribiani";
athlete[2].Age = 22;
athlete[2].Height1 = 5.6;
athlete[2].Weight = 140;
athlete[2].BankName = "Apple";
athlete[2].BankAccount = 123124;
athlete[2].Balance = 400;
#endregion

for (int i = 0; i < athlete.Length; i++)
label1.Text += athlete[i].ToString();
}
class TestClasses
{
[STAThread]
static void Main()
{
Person person = new Person();
Application.Run(person);
}
}

-- modified at 2:14 Wednesday 25th January, 2006
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 
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 

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.