Socarsky
Well-known member
- Joined
- Mar 3, 2014
- Messages
- 59
- Programming Experience
- Beginner
How to get a variable's value after hiding a form?
I need to get a string variable's value after hiding a form from another form.
I used a property for that but it does not work.
Form1's code:
Form2's code:
I need to get a string variable's value after hiding a form from another form.
I used a property for that but it does not work.
Form1's code:
private string strPSqlDBname; public string passDBname { get { return strPSqlDBname; } set { strPSqlDBname = value; } } internal void populate() { passDBname = txtPervasiveDBName.Text; } Hide(); using (Form2 fmr2 = new Form2()) frm2.ShowDialog(); Application.Exit();
Form2's code:
string getDBname; Form1 frm1 = new Form1(); frm1.populate(); getDBname = frm1.passDBname; string ConnStrPSql = "Server Name=xxxxx;Database Name='" + getDBname + "';User ID=administrator;Password=xxxxx;";
Last edited: