Set the text of a textbox based of a list of characters

Viewed 151

So I have the following form:

enter image description here

What I'm trying to achieve is the following:

After entering a name, I want the initials of the name to be generated just by clicking the initials textbox.

I have found the following method to get the first characters of a string:

string EngineerName = tb_Name.Text.ToString();
EngineerName.Split(' ').ToList().ForEach(i => Console.Write(i[0] + " "));

My question was, how would I assign the list of characters to the text of a textbox?

I tried:

private void Tb_Initials_Click(object sender, EventArgs e)
        {
            string EngineerName = tb_Name.Text.ToString();
            EngineerName.Split(' ').ToList().ForEach(i => Console.Write(i[0] + " "));

            tb_Initials.Text = EngineerName;

        }

But this just fills up the text box with the exact same name...

3 Answers
Related