I have a datagrid on a form where you can put in numbers for a spacing.
I am trying to get the code to place the item at the first space dictated by the first row of the datagrid, then for the second row add that number to the first row etc.
If you look at the picture what I want to do is place an item at 120 on the first row. Then the second Row I want to add that to the first one so the item would be placed at 240 inches. Then the third row added to the total of the first to so it would be at 360.
Right now xVal is where the items are being placed.
Here is the code I have so far which isnt right. It puts everything at 120 inches.
Thanks
Expand|Select|Wrap|Line Numbers
- double xVal = 0;
- DataGridViewRow EndPostSpacing = d_Endpost.Rows[i];
- string PostSpacing = EndPostSpacing.Cells["EPSpacing"].Value.ToString();
- double PostSpacingTotal = I2M(double.Parse(PostSpacing.ToString()));
- if (PostSpacingTotal == 0)
- {
- if (xVal == 0)
- {
- PostSpacingTotal = 0;
- }
- }
- xVal += PostSpacingTotal;