Asssignment 4 - D Chao ISYS 350 Fall 2014 PART 1 private void button1_Click(object sender EventArgs e cfw dataGridView1.ColumnCount = 4

Asssignment 4 - D Chao ISYS 350 Fall 2014 PART 1 private...

This preview shows page 1 - 3 out of 7 pages.

D. Chao ISYS 350 Fall 2014
Image of page 1
PART 1 private void button1_Click(object sender, EventArgs e) { dataGridView1.ColumnCount = 4; dataGridView1.Columns[0].HeaderText = "Year"; dataGridView1.Columns[1].HeaderText = "Value at Begining of Year"; dataGridView1.Columns[2].HeaderText = "Depreciation During Year"; dataGridView1.Columns[3].HeaderText = "Total depreciation to End of Year"; double value, life, depreciation, totalDepreciation = 0; value = double.Parse(textBox1.Text); life = double.Parse(textBox2.Text); for (int year = 1; year <= life; year++) { if (year == life) { depreciation = value; dataGridView1.Rows.Add(); dataGridView1.Rows[year - 1].Cells[0].Value = year; dataGridView1.Rows[year - 1].Cells[1].Value = value.ToString("c"); dataGridView1.Rows[year - 1].Cells[2].Value = depreciation.ToString("c"); totalDepreciation += depreciation; dataGridView1.Rows[year - 1].Cells[3].Value = totalDepreciation.ToString("c"); value -= depreciation; } else { depreciation = value *2 / life; dataGridView1.Rows.Add(); dataGridView1.Rows[year - 1].Cells[0].Value = year; dataGridView1.Rows[year - 1].Cells[1].Value = value.ToString("c"); dataGridView1.Rows[year - 1].Cells[2].Value = depreciation.ToString("c");
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 7 pages?

  • Fall '10
  • LI
  • Depreciation, private void, Dr. Chao

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture