Displaying new dialog from a user control


hello,

i have application in c sharp.

the main form contains panel in displaying user control.

that user control contains button named "start". want open form2 after clicking on start button.

form2 contains picturebox. after clicking on start button creating object of form2

and passing image should display onto picturebox.

i passing image form2 in constructor , saving image local variable of form2.

then assigning image picturebox's backgroundimage.

after doing form2.showdialog() in start _buttonclicked();

then showdialog throwing exception "parameter not valid" because local image variable becoming null.

i not getting why variable becoming null?

what should local image variable wont become null?

 


i dont know did, how should work:

  //form1:     private void button1_click(object sender, eventargs e)     {       string strimage = @"c:\1\backward.png";       form2 f2 = new form2(strimage);       f2.showdialog();     }  //form2:     public form2(string imagepath)     {       //form2 constructor       initializecomponent();       picturebox1.image = new bitmap(imagepath);     }  


mitja



Visual Studio Languages  ,  .NET Framework  >  Visual C#



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'