I am using VS 2008 (C#)... I have created a function in a GlobalClass to use it globally.. This is for opening a dialog box. When I call this function in my method it works but
I guess what you want is
static class GlobalClass
{
public static OpenFileDialog OFDbutton()
{
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "Image files|*.jpg;*.jpeg;*.png;*.gif";
DialogResult dr = ofd.ShowDialog();
return ofd;
}
}
which gives back the OpenFileDialog
object. Now you can
OpenFileDialog ofd = globalclass.ofdbutton(); //Calling the function
label1.text=ofd.filename;