Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 132,687 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,279 people online right now. Registration is fast and FREE... Join Now!




Which Event is fire !

 
Reply to this topicStart new topic

Which Event is fire !, using .show method jump one form to another and then return back so wh

nomanforu
post 4 Jun, 2008 - 08:45 PM
Post #1


New D.I.C Head

*
Joined: 29 May, 2008
Posts: 2

hi !
i have two project in one solution , form1 from project 1 is running and i m calling from this to prject2 form 2 like that

project2.form2 f = new project2.form2();
f.show();

on the buton of form1 call this and form is opening succesfully but when i closed the form2 then its back to form 1 , becouse form 1 is already opend then my question is that which event is fire when i got back to form1 , i checked Activated event is not working may b cumming from other project , may what is differnce b/w show and showdailogue() , when i call like f.showdailogue() ; then its just open and closed automatically .

Further Detail :
i have a image on form1 i move this image to form2 and edit that image and then save and when i return back to form1 then its should automatically update but its not updated , when i found the event then on that event in form1 i just reload the image to given path .



User is offlineProfile CardPM

Go to the top of the page

allensmith
post 5 Jun, 2008 - 12:47 AM
Post #2


New D.I.C Head

*
Joined: 4 Jun, 2008
Posts: 11



Thanked 3 times
My Contributions


Hello,

You can try passing on the image from Form1 to Form2 when the Form2 is loaded. After modifications, pass on the
modified image back to Form1 on the FormClosing() event of Form2.

Lets say we have a Picture box on Form1. We will pass on the image on Form2 and after modifications, put the
image back on PictureBox after form2 is closed.

1. Declare public variables in Form2.

Form1 _frm;
Image _img;

2. Create a Function in Form2

CODE

    public void ShowForm(Form1 frm, Image img)
    {
            
        _frm = frm;
        _img = img;
        this.Show();
            
    }


3. After modifications, pass on the image back in FormClosing Event

CODE

        private void Form2_FormClosing(object sender, FormClosingEventArgs e)
        {

    _frm.C1FlexGrid1[1, 1] = "Testing only";
    _frm.PictureBox1.Image = _img;
        }


In Form1 you can call the Form2 in the following manner:

CODE
        
                Form2 frm = new Form2();
    frm.ShowForm(this, this.PictureBox1.Image);


I hope this will help.

Regards,

Allen

This post has been edited by allensmith: 5 Jun, 2008 - 01:06 AM
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 11/23/08 07:22AM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month