I am new to programming, so excuse my novelty. I use Visual Studio, and in my program I have some variables in the settings, which are called months;
JanuaryTotalAmount
JanuarySpentAmount
JanuaryGainedAmount
FebruaryTotalAmount
FebruarySpentAmount
FebruaryGainedAmount
ect...
So, in my code, when I assign them to values, I:
Properties.Settings.Default.JanuaryTotalAmount += EnteredAmount;
Properties.Settings.Default.SpentAmount -= EnteredAmount;
They simply add the values ββthat are entered to get the total.
But I tried to keep my code tidier and wondered if there is a way based on the fact that the user selects it, this will change the name of the month ...
So,
string month = txtBoxMonth.Text;
Properties.Settings.Default."month"TotalAmount += TotalAmount
This will not allow me to create a giant switch statement for each month. I don't know if there is a way to do this or not, but any help would be appreciated.
source
share