I have a WPF Application which contains a class called RateView.xaml.cs and MainWindow.xaml.cs
The MainWindow.xaml.cs contains three textboxes of which values I want to
Just a small example (This is winforms)
This is the mainwindow, where your textbox is:
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
1
public string TextBox1Text
{
get { return textBox1.Text; }
set { textBox1.Text = value;
}
}
and this is a class where you want to interact with the textboxes:
public class Test
{
public Test(Form1 form)
{
//Set the text of the textbox in the form1
form.TextBox1Text = "Hello World";
}
}
To get and set the value of a textbox within another class/form you can do it with something like:
public string TextBox1Text
{ get { return textBox1.Text; }
set { textBox1.Text = value; } }