I am very new to coding and have been asked to do the following: Create two static arrays that will hold the gross and net income. A user will input the gross income every month and the net must be calculated and saved.
Now what iv have so far is this:
public partial class Form1 : Form
{
public static double[] gross { get; set; }
public static double[] net { get; set; }
public Form1()
{
InitializeComponent();
}
private void btnEnter_Click(object sender, EventArgs e)
{
Gross g = new Gross();
g.ShowDialog();
gross = new double[] { g.grossTemp };
net = new double[] { g.netin };
}
}
But every time i want to add a new gross and net income, it replaces the old one instead of adding the new one to a new index. I think the problem is because i'm creating a new instance but i don't know what else to do.