Hi,
You have to pass a reference from the current form to the new form,
something like this:
Form2 f2 = new Form2( this ); // here I pass the reference to the current
form, where the Sql* are declared
f2.ShowDialog();
This is how Form2 looks like
class Form2{
Form1 parent
public Form2( Form1 parent){
this.parent = parent;
}
then in the Form2 you can use
parent.SqlCommand , etc
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Alberto" <al*****@nospam.com> wrote in message
news:uh**************@tk2msftngp13.phx.gbl...
I have in a form a SqlConnection and a SqlCommand but I also want to use
them in form shown as DialogForm. I declared the objects as public but I
don't know how to go on.
Thank you.