Realizar operaciones con valores de una columna y mostrar los resultados en otra columna distinta.
Publicado por Eduardo (2 intervenciones) el 15/12/2016 02:34:58
Espero me puedan ayudar por favor. Quiero hacer cálculos con todos los valores de una columna (almacenada en una bd local) y mostrar los resultados de estos en otra nueva pero no se como hacerlo. Debido a esto me da el siguiente error: An unhandled exception of type 'System.NullReferenceException' occurred in AutoCompletarTextBox.exe
Additional information: Object reference not set to an instance of an object.
Este es mi código:
Additional information: Object reference not set to an instance of an object.
Este es mi código:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
private void btnCalcular_Click_1(object sender, EventArgs e)
{
DataGridViewTextBoxColumn columna1 = new DataGridViewTextBoxColumn();
columna1.HeaderText = "Simulator";
columna1.Width = 200;
columna1.Name = "Simulator";
dataGridView1.Columns.Add(columna1);
for (int i = 0; i < (this.dataGridView1.RowCount - 1); i++)
{
decimal eff = decimal.Parse(txtEFFsim.Text);
int fijo2 = int.Parse(lblfijo2.Text);
decimal resp = eff / fijo2;
int operador = int.Parse(txtQtyOp.Text);
decimal ratee = int.Parse(txtRate.Text);
decimal efff = resp;
decimal res4 = operador / ratee * efff;
this.dataGridView1.Rows[i].Cells["Simulator"].Value.ToString();
}
}
private void frmDataGridCalculation_Load(object sender, EventArgs e)
{
// TODO: This line of code loads data into the 'sisIndustrialDataSet2.CWS' table. You can move, or remove it, as needed.
this.cWSTableAdapter.Fill(this.sisIndustrialDataSet2.CWS);
}
}
}
Valora esta pregunta
0