you could try this. this would allow you to get the texboxvalue from form2.
in form1
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.Control | Keys.Space))
{
Box form = new Box();
form.TextExport = richTextBox1.SelectedText;
form.ShowDialog();
richTextBox1.Text = richTextBox1.Text + "\n" + form.texvalue;
}
return base.ProcessCmdKey(ref msg, keyData);
}
in form2
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.Enter))
{
MessageBox.Show("Hi");
MainWindow form1 = new MainWindow();
texvalue = textBox1.Text;
this.Close();
}
return base.ProcessCmdKey(ref msg, keyData);
}
public string TextExport
{
get { return textBox1.Text; }
set { textBox1.Text = value; }
}
public string texvalue = String.Empty;
sorry for the terms i use i'm not good at them.
hope this will help you this time.