I have 3 classes, a student class, a studentList class, and a form. The ToString method is implemented in the student class, and a few students have been created and added in the studentList class.

In the form, I'd like my current list of students to show up in a multiline textbox at application launch. I wasn't sure how to do that, so to test my methods I just called a messageBox to display my students. Here's what my messagebox shows:

WindowsFormApplication.studentList

Any idea why my list isn't being shown correctly?

By the way, here is the ToString method from the student class:

public override string ToString()
        {
            return Crn + "\t" + Subj + "\t" + Crse + "\t" + Sec;
        }

Recommended Answers

All 2 Replies

Nevermind, for some reason our professor didn't ask us to include a tostring method in the studentList class as well, so I just added one and it works fine now. If there's a different way to do it please let me know.

You can always use the form load event if you want to do something beforehand :private void Form1_Load(object sender, EventArgs e)

{
//do something before other actions
}
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.