Hello,
i'm a beginner with c# and visual studio,
i don't understand that i get the error 'Error 1 A field initializer cannot reference the non-static field, method, or property 'WpfApplication5.MainWindow.textBox1
my code:
public partial class MainWindow : Window
{
int getal=Convert.ToInt32(textBox1.text);
public MainWindow()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
if (getal > 1)
{
MessageBox.Show("groter dan 1");
}
else
{
MessageBox.Show("kleiner dan 1");
}
}
}
}
Can anyone help me please?
