Use the constructor of the Form. You can (just like any other 'function')
overload it.
So you should get something like :
FrmSeguranca oform = new FrmSeguranca(sDBUsern DBPassw, sDBDsn); // notice
i'm not using Form here
oform.Show();
And then in your class FrmSeguranca you have the following
class FrmSeguranca {
// some things like private variables, other constructors, ...
// The constructor you wish to use
public FrmSeguranca(string username, string password, string dsn)
{
// and here you do your connection
}
}
HTH
Yves
"Bernardo" <bp****@sapo.pt> schreef in bericht
news:68**********************************@microsof t.com...
Hi,
In Visual Basic there are modules where I can store public variables,
Constants, etc. I have in a C# program a class that have a method to open a form.
public void GUIGestaoAcessos(string sDBUser, string sDBPassw, string
sDBDsn) {
Form oform=new FrmSeguranca();
oform.Show(); //He will connect to DB using the method parameters...
}
How can I pass the method parameters (string sDBUser, string sDBPassw,
string sDBDsn) into the form so that He can use them...
Thanks for your help,
Bernardo