We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,716 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Refreshing a form from another from

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.

3
Contributors
2
Replies
3 Days
Discussion Span
5 Months Ago
Last Updated
3
Views
PraveenaMani
Newbie Poster
1 post since Nov 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

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

soaad
Newbie Poster
1 post since Dec 2009
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

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

arunkumars
Posting Whiz in Training
204 posts since Jul 2009
Reputation Points: 26
Solved Threads: 22
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0602 seconds using 2.7MB