1.I Have one form with a textbox

2.In keyDown event While pressing F1 an another form opens.

3.In the second form,i have a richtextbox.I want to edit tat richtextbox and pass that value to form1's textbox while clicking a button in form2.

Form1 Code:

private void Export_Load(object sender, EventArgs e)
    {
        textBox1.Text = "hai hello welcome to chennai";
    }private void textBox1_KeyDown(object sender, KeyEventArgs e)
    {
        if (e.KeyCode ==Keys.F1)
        {
            rchbox rch = new rchbox();
            rch.Show();
            rch.richTextBox1.Text = textBox1.Text;
        }
    }
Form2 Code:

public rchbox()
    {
        InitializeComponent();
    }
    Export ex = new Export();
    Class1 c = new Class1();
    private void button1_Click(object sender, EventArgs e)
    {
        c.txt = richTextBox1.Text;
        ex.textBox1.Text = richTextBox1.Text;
        ex.textBox1.Refresh();
        ex.Refresh();
        ex.Invalidate();
       // ex.textBox1.Invalidated();
        this.Close();

    } 

I have found the problem that the form1 is not refreshed.i have even tried by calling refresh method. Can any one tell me.

Recommended Answers

All 2 Replies

I have different soln with out refresh
1-u declare static variable in form1 and store the value u want.
2-in form2,call form1.variable and use it as u like

why dont you try using delegates to work this out. ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.