void ClearAllRichtextboxes()
{
richTextBox3.Clear();
richTextBox5.Clear();
richTextBox6.Clear();
richTextBox9.Clear();
richTextBox10.Clear();
}
ClearAllRichtextboxes();
if (comboBox5.Text == "Primer")
{
richTextBox5.Text = "This is the number of primer tins" + primer.ToString();
richTextBox6.Text = "This is the cost of the primer tins" + primercost.ToString();
}
if (comboBox3.Text == "Matt")
{
richTextBox10.Text = "This is how many 2.5 tins of paint are needed: " + val44.ToString();
richTextBox9.Text = "This is the matt cost" + valmatt.ToString();
}
if (comboBox3.Text == "Vinyl ")
{
richTextBox10.Text = "This is how many 2.5 tins of paint are needed" + val44.ToString();
richTextBox9.Text = "This is the of vinyl cost" + valmatt.ToString();
}
if (comboBox3.Text =="Silk")
{
richTextBox10.Text = "This is how many 2.5 tins of paint are needed" + silkval.ToString();
richTextBox9.Text = "This is the cost: " + valcostsilk.ToString();
}
目前我正在將文本插入多個文本框,而不是我想在一個富文本框中輸出變量 - 通過附加字符串。如何在c#中將變量輸出到一個接一個的富文本框?
已經在下面的答案解釋如何可以連接兩個字符串,使用'+'運算符和'string.Format'。你也可以使用['stringBuilder'](https://docs.microsoft.com/en-us/dotnet/standard/base-types/stringbuilder)類 - 當你進行多個連接時,它會稍微高效一些。 – Nisarg