How can I display output of array on a form?

Viewed 31

i am having trouble displaying this array output to a form. what is the issue I am sure it is an easy fix and being new to c# programming i seem to find my error

class Program
    {
        public static void Menu ()
        {
            string[] names = { "Bob Johnson", "Amy Larsen", "Reed McMichels", "Mary Jones", "Sheila Stone" };
            for (int i = 0; i < names.Length; i++)
            {
                Console.WriteLine(names[i]);
1 Answers

As i can see, there is no Winforms code for the question but here is your answer!

string[] names = { "Bob Johnson", "Amy Larsen", "Reed McMichels","Mary Jones", "Sheila Stone"}; foreach (var name in names){ Console.WriteLine(name); }

Related