how to Acces a Button/Textbox..... from mainwindow in class
Im new at OOP and im wondering how i can say in my edit Class, get this textbox from the mainwindow and clear it. I tried this:
public partial class MainWindow : Window
{
Edit edit = new Edit();
public MainWindow()
{
InitializeComponent();
}
private void ClearBtn_Click(object sender, RoutedEventArgs e)
{
//TxtBox.Clear();
edit.Clear();
}
}
Edit class
public class Edit
{
MainWindow main = new MainWindow();
public void Clear()
{
main.TxtBox.Clear();
}
public Edit()
{
}
}
from Recent Questions - Stack Overflow https://ift.tt/3o7y0gx
https://ift.tt/eA8V8J
Comments
Post a Comment