3
Hello, I am developing a dental software which one of the functions is to select a tooth on a button and add the name of this tooth in a textbox. Until then no problem, but the point is that this textbox refers to observations, and I would like the name of each selected tooth, be added in the textbox in different lines and not side by side. So as each button referring to each tooth is selected it adds the name of the teeth one in each row. For example, when I click button1 is added the text "Bot1" in the textbox and so on, the problem is that if I click more than one button the text should go to different lines and not in the same. That’s what I’d like but I can’t develop a logic to do that someone has some idea?
follow the click event I’m using on the Uttons:
private void button1_Click(object sender, EventArgs e)
{
string Texto = txtObservacao.Text;
txtObservacao.Text += "Terceiro Molar Inf.Direito (48):";
if (btnMolar48.BackColor == Color.FromArgb(150, Color.LightSeaGreen))
{
btnMolar48.BackColor = Color.Transparent;
txtObservacao.Text = Texto.Replace("Terceiro Molar Inf.Direito (48):", "");
}
else
{
btnMolar48.BackColor = Color.FromArgb(150, Color.LightSeaGreen);
}
}
private void btnMolar47_Click(object sender, EventArgs e)
{
string Texto = txtObservacao.Text;
txtObservacao.Text += "\n" + "Segundo Molar Inf.Direito(47):";
if (btnMolar47.BackColor == Color.FromArgb(150, Color.LightSeaGreen))
{
btnMolar47.BackColor = Color.Transparent;
txtObservacao.Text = Texto.Replace("Segundo Molar Inf.Direito(47):", "");
}
else
{
btnMolar47.BackColor = Color.FromArgb(150, Color.LightSeaGreen);
}
}`
Thank you.
There are also the two together, which is the
\r\n
. I just don’t know his name. And if I’m not mistaken, theEnvironment.NewLine
uses this mentioned value.– CypherPotato
It is the junction of the two (would be CRLF). The
Environment.NewLine
uses the appropriate character according to the platform being used (Windows uses both)– Jéf Bueno