im creating a list to update a MySql db with values form text boxes, how can i make somthing like this work?
if i use the
verdierX[0] = (int)decimal.Parse(box1.Text);
it works just fine but when i try to use it in a loop like this is blowes up. Anyone got a suggestion on how to solve this?
int[] dbNavnX = new int[8];
int[] verdierX = new int[8];
string[] boxList = new string[8];
private void Form1_Load(object sender, EventArgs e)
{
boxList[0] = "box1.Text";
boxList[1] = "box2.Text";
boxList[2] = "box3.Text";
boxList[3] = "box4.Text";
boxList[4] = "box5.Text";
boxList[5] = "box6.Text";
boxList[6] = "box7.Text";
boxList[7] = "box8.Text";
}
private void sumX()
{
for (int sum = 0; sum < 8; sum++)
{
verdierX[sum] = (int)decimal.Parse(boxList[sum]);
}
}