simon29
January 7th, 2003, 07:31 AM
Hi!
I need to pass some parameters from one window form to another. These parameters need to be changed in the second window, and the changes need to be reflected in the first window. Therefore I use the REF syntax. Everythings seems to run, but when I close the second window, any change has been made to the parameters in the first one. Anyone can have a look to the code.
Many thanks in advance
simon
CODE----------------------------------------------------------------------
/*this part of code is what I do in the first window to create an instance of the second window:*/
ConnectionForm connWindow = new ConnectionForm(ref __sqlServer, ref __sqlServerUser, ref __sqlServerPassword, ref __sqlServerDatabase);
connWindow.ShowDialog();
connWindow.Dispose();
/*This part is in the second window, where I store the parameters in my own variables (not initialized) to be able to change their values later*/
private string m_server, m_user, m_password, m_database;
public ConnectionForm(ref string server, ref string user, ref string password, ref string database)
{
InitializeComponent();
m_server= server;
m_user= user;
m_password= password;
m_database= database;
}
-----------------------------------------------------------------------------------
The problem appears when I close this form, the parameters of the window which calls the second window donīt change.
I need to pass some parameters from one window form to another. These parameters need to be changed in the second window, and the changes need to be reflected in the first window. Therefore I use the REF syntax. Everythings seems to run, but when I close the second window, any change has been made to the parameters in the first one. Anyone can have a look to the code.
Many thanks in advance
simon
CODE----------------------------------------------------------------------
/*this part of code is what I do in the first window to create an instance of the second window:*/
ConnectionForm connWindow = new ConnectionForm(ref __sqlServer, ref __sqlServerUser, ref __sqlServerPassword, ref __sqlServerDatabase);
connWindow.ShowDialog();
connWindow.Dispose();
/*This part is in the second window, where I store the parameters in my own variables (not initialized) to be able to change their values later*/
private string m_server, m_user, m_password, m_database;
public ConnectionForm(ref string server, ref string user, ref string password, ref string database)
{
InitializeComponent();
m_server= server;
m_user= user;
m_password= password;
m_database= database;
}
-----------------------------------------------------------------------------------
The problem appears when I close this form, the parameters of the window which calls the second window donīt change.