So im getting this error and i dont quite understand why im getting it. i have tried looking here for answers, but every problem is so unique that they do not apply to my problem.
Here is what i have so far.
class customer{
public string sFirstName { get; set; }
public string sLastName { get; set; }
public int iAge { get; set; }
}
class customerObject{
public static List<customer> lstStaticUsers { get; set; }
public customerObject(){
lstStaticcustomer = new List<customer>();
}
public static void AddNewStaticUser(string FirstName, string LastName, int Age)
{
lstStaticcustomer.Add(new customer{sFirstName = FirstName, sLastName = LastName, iAge = Age});
}
}
Here is my window
public partial class wndCustomerInfo : Window
{
public wndCustomerInfo ()
{
InitializeComponent();
}
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
this.Hide();
e.Cancel = true;
}
private void btnSubmitForm_Click(object sender, RoutedEventArgs e)
{
customerObject.AddNewStaticcustomer(txtFirstName.Text, txtLastName.Text, Convert.ToInt32(txtAge.Text));
lblMessage.Content = "Created new user: " + txtFirstName.Text;
}
}
then here is my main window that opens the one above
public partial class MainWindow : Window
{
wndCustomerInfo wndCustomerInfoForm;
public MainWindow()
{
InitializeComponent();
Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;
wndCustomerInfoForm= new wndCustomerInfo ();
}
private void btnSave_Click(object sender, RoutedEventArgs e)
{
this.Hide();
wndCustomerInfoForm.ShowDialog();
this.Show();
}
}
If anyone could help that would be great. im kind of new to c# so please be nice