Firstoff I have to say that I am new to the c# programming. My problem is, that I have a window with a textbox and a button in it and what I am trying to accomplish is to write some text into the textbox and on button click I'd like to save that text into the ukony.txt file. But using the code bellow, after clicking a button nothing happens.
public partial class Window1 : Window {
public Window1() {
InitializeComponent();
}
private void button_Click(object sender, RoutedEventArgs e)
{
string writerfile = @"D:\Games\ukony.txt";
Window1 a = new Window1();
using (StreamWriter writer = new StreamWriter(writerfile))
{
writer.WriteLine(a.textBlock.Text);
writer.WriteLine(a.textBlock1.Text);
}
}
}