I have a form (form1) that has a text field (textBox1)
I have a class that has the method “public static string getValue()”
how I can read the value of the textBox1 within the method getValue() ??
here is my code
namespace MyProgram
{
public partial class Form1: Form
{
---------------------------------
---------------------------------
---------------------------------
}
}
the other class
namespace MyProgram
{
class values
{
public static string getValues()
{
string v;
v = ------get value from textBox1 in Form1
return v;
}
}
}
the whol software is build in this structure, so I hope there is some standard way in C# to get these values in the method getValue()
You have to instantiate new object of Form1 and get the value. Or else add a delegate in form1 and call it from getValue, such that the return value of delegate should be the textbox value.