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();
}
Currently I am inserting text into multiple textboxes, instead I would like to output variables in one rich text box - by appending the strings.
Update the
richTextBox.Text
with the new information. If you want to append the new strings to what is already there use "+". You can save the string as its own variable if it helps.More info about string concatenation: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/strings/how-to-concatenate-multiple-strings
You could do something like string formatting to help space the strings with spaces.
something like
\r\n indicates a new line, you can find more information about the String.Format() method on msdn: https://msdn.microsoft.com/en-us/library/system.string.format(v=vs.110).aspx