1) I'm trying to add text to "richTextBox1" as stage 1 of a larger application.
2) The text is data coming from checkboxes
3) When CheckBox1 is checked and the "EnterDataButton" is pressed the text is entered in the box as the code says, however, if more than one box is checked, only the most senior piece of text is entered.
For instance, if boxes 1+2 are checked then only the text for box 2 will be entered and if 3+9 then only txt relating to 9 will be entered.
4) My goal is to enter the relevant txt for all checked boxes on a new line of "richTextBox1"
5) Further to this, once the data is collected in "richTextBox1" i'd like to save it to a file.
so what have i tried......... I've had a play around with \n and \r but failed miserably.
I've also tried playing with the if argument and again failed..
any help would be great..
private void EnterDataButton_Click(object sender, EventArgs e)
{
if (checkBox1.Checked) richTextBox1.Text = ("box1 done");
if (checkBox2.Checked) richTextBox1.Text = ("box2 done");
if (checkBox3.Checked) richTextBox1.Text = ("box3 done");
if (checkBox4.Checked) richTextBox1.Text = ("box4 done");
if (checkBox5.Checked) richTextBox1.Text = ("box5 done");
if (checkBox6.Checked) richTextBox1.Text = ("box6 done");
if (checkBox7.Checked) richTextBox1.Text = ("box7 done");
if (checkBox8.Checked) richTextBox1.Text = ("box8 done");
if (checkBox9.Checked) richTextBox1.Text = ("box9 done");
if (checkBox10.Checked) richTextBox1.Text = ("box10 done");
If it's any help, i'm using Microsoft Visual C# 2010 Express


Sign In
Create Account

Back to top









