主题:如何将listBox中一行加到指定的textBox
想实现把listBox选中行添加到当前激活的textBox中,但激活TextBox后再单击ListBox,textBox的Focused属性成了"false",我自己代码如下,请问怎么修改能实现我的想法
private: System::Void listBox1_Click(System::Object^ sender, System::EventArgs^ e)
{
String^ file = listBox1->SelectedItem->ToString();
if (textBox2->Focused )
{
textBox2->Text = file;
}
else if (textBox7->Focused)
{
textBox7->Text = file;
}
else if (textBox3->Focused)
{
textBox3->Text = file;
}
else if (textBox6->Focused)
{
textBox6->Text = file;
}
}
private: System::Void listBox1_Click(System::Object^ sender, System::EventArgs^ e)
{
String^ file = listBox1->SelectedItem->ToString();
if (textBox2->Focused )
{
textBox2->Text = file;
}
else if (textBox7->Focused)
{
textBox7->Text = file;
}
else if (textBox3->Focused)
{
textBox3->Text = file;
}
else if (textBox6->Focused)
{
textBox6->Text = file;
}
}