Passing a parameter into ShowDialog

  • Thread starter Thread starter carmen
  • Start date Start date
C

carmen

I need to pass a parameter to a class while calling Showdialog method, is
this possible?
Thanks,
Carmen
 
Hi Carmen,

Sure it is. Either expose some public method or property in the dialog, or pass it a reference that it can use to obtain data when needed.

Happy coding!
Morten Wennevik [C# MVP]
 
protected override DialogResult ShowDialog(object MyCustomParameterObject)
{
this.CustomParam = MyCustomParameterObject;
return this.ShowDialog();
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top