Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reloading windows form without closing and reopening

Tags:

c#

winforms

I have an windows forms application written in c#. I want to reload form when someone press the "clear" button in it. But I couldn't achieve to call Load event.These lines didn't also work :

  this.Refresh();
  this.Load +=new EventHandler(Grafik_Load); // 'Grafik' is the name of the form.

What should I do about this? Thanks for helping..

like image 329
user741319 Avatar asked Oct 11 '11 11:10

user741319


2 Answers

Place the 'load' code in a separate function and call that function from you're own code/Load event handler.

like image 168
CodingBarfield Avatar answered Sep 21 '22 18:09

CodingBarfield


        private void callonload()
        {
          //code which u wrriten on load event
        }
        private void Form_Load(object sender, EventArgs e)
        {
          callonload();
        }
        private void btn_clear_Click(object sender, EventArgs e)
        {
          callonload();
        }
like image 34
Nitin... Avatar answered Sep 22 '22 18:09

Nitin...