I want to get the values from fom1 form to myclass . Inside myclass I written my database code for selecting records and after selecting records from db I want to display in textbox of form1.
please suggest suitable solution.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Nattudurai EswaramurthyPosted Aug 20, 2012, 4:48 AM
Use function call to where use out params and set the out param values after u will get the value from DB.
call the function in ur form which will point to ur class.
eg.
in ur form call:
string name;
string address;
MyClass1.MyDBValue(out name, out address); // this will return the value from DB
Your Response is important to us. Please Check this is Correct Answer, if it helped
VulpesPosted Aug 20, 2012, 4:44 AM
You can then write to it from code in myclass as follows:
Form1 f1 = (Form1)Application.OpenForms["Form1"];
f1.textBox1 = "whatever";