-
October 31st, 2010, 06:14 PM
#1
Copy selected text in a checkbox
Yet another question arises. So far I have majority of my application finished, but the next problem has arisen.
How do I go about copying text from a checked checkbox. I had it set so it would copy the text but it would copy it whether the box was checked or not. What string of text to do I need to add in to have it copy the checked boxes text?
Btw...Happy Halloween Everyone!
Last edited by klturi421; October 31st, 2010 at 06:22 PM.
-
October 31st, 2010, 07:03 PM
#2
Re: Copy selected text in a checkbox
I don't understand the question.
What text are you talking about?
Are you referring to a Windows.System.Forms.CheckBox.Text property? And if so, what do you mean by copy?
-
October 31st, 2010, 07:19 PM
#3
Re: Copy selected text in a checkbox
this might help:
private void button2_Click(object sender, EventArgs e)
{
string[] checkeditems = new string[checkedListBox1.Items.Count];
for (int i = 0; i < checkedListBox1.CheckedItems.Count; i++)
{
checkeditems[i] = checkedListBox1.CheckedItems[i].ToString();
}
textBox3.Lines = checkeditems; //or you can do whatever you want with the array
}
-
November 1st, 2010, 09:59 PM
#4
Re: Copy selected text in a checkbox
How would I combine the code above with the code I have below?
private void button1_Click(object sender, EventArgs e)
{
string[] combotext = new string[12];
combotext[0] = "text1 " + textBox2.Text.ToString();
combotext[1] = "text2 " + textBox3.Text.ToString();
combotext[3] = "text3 " + textBox4.Text.ToString();
combotext[2] = "text4" + textBox5.Text.ToString();
combotext[4] = "text5" + textBox9.Text.ToString();
combotext[5] = "text6 " + textBox8.Text.ToString();
combotext[6] = "text7 " + textBox7.Text.ToString();
combotext[7] = "text8 " + comboBox1.Text.ToString();
combotext[8] = "text9 " + checkBox1.Text.ToString();
combotext[9] = "text10 " + textBox6.Text.ToString();
combotext[10] = "text11 " + textBox11.Text.ToString();
combotext[11] = "text12" + textBox10.Text.ToString();
textBox1.Lines = combotext;
}
-
November 1st, 2010, 10:18 PM
#5
Re: Copy selected text in a checkbox
-
November 1st, 2010, 10:26 PM
#6
Re: Copy selected text in a checkbox
i honestly have no idea what the e is referring to. I am just slapping this together. I have not a clue as to what any of this coding truly means other than what I am slowly picking up at the moment.
What does e and .index have to do with eachother?
-
November 1st, 2010, 10:52 PM
#7
Re: Copy selected text in a checkbox
you need to have a second event trigger/button to transfer the checked items to do what you want with it.
that is where the code i gave you comes into play
-
November 2nd, 2010, 10:50 PM
#8
Re: Copy selected text in a checkbox
Any control's property can be read by getting its name during runtime. It can also be set similarly. Does e have a Name property here? You can use that retrieve checkbox control itself.
May be you cna handle it in the checkbox_clicked event???
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|