enter image description here

I tried using \ n and console.writeline (), but the code did not help:

private void enter_Click(object sender, EventArgs e) { bool elogin; bool epass; string login = "ivan"; string password = "12345"; if (enter_login.Text == "ivan") nickname = "Ivan"; else nickname = " "; if (enter_login.Text == login) elogin = true; else elogin = false; if (enter_password.Text == password) epass = true; else epass = false; if (elogin == true && epass == true) panel1.Visible = false; else MessageBox.Show("Неверный логин или пароль"); list_chat.Text += nickname; } private void enter_button_Click(object sender, EventArgs e) { string message = " "; message = enter_chat.Text; chat_window.Text += "[" + nickname + "]: " + message.ToString() + "\n"; } 

    1 answer 1

    If the chat_window control generally allows multi-line text, then use the generic Environment.NewLine property to chat_window line.

    Also I do not advise using string concatenation in your case. The fact is that strings are immutable, so you will create new and new instances of strings each time, which will increase memory consumption. It is better to use the AppendText() method.