andrewmanuja
Well-known member
- Joined
- May 30, 2019
- Messages
- 75
- Programming Experience
- Beginner
Hi All,
I am developing an app to manage stocks.
I am loading drug orders related data into a window form (basically to a dataGridView) and need to calculate the sum of a column. For the said, purpose, I am using the below code within the FormLoad event;
int d = 0;
for(int n=0; n< dataGridViewOrder .Rows.Count; n++)
{
d += Convert.ToInt32(dataGridViewOrder.Rows[n].Cells[5].Value);
}
I want to perform a condition in a different method within the same Class based on the value of the variable "d" defined above.
However, I am not so sure how I can accomplish this task. Further, I could create the above calculating the value of "d" as a separate function within the same class and not so sure how to call it in another function passing the parameter values to evaluate the condition.
Could someone please help me with this issue?
Thank you in advance.
Kind regards,
Andrew
I am developing an app to manage stocks.
I am loading drug orders related data into a window form (basically to a dataGridView) and need to calculate the sum of a column. For the said, purpose, I am using the below code within the FormLoad event;
int d = 0;
for(int n=0; n< dataGridViewOrder .Rows.Count; n++)
{
d += Convert.ToInt32(dataGridViewOrder.Rows[n].Cells[5].Value);
}
I want to perform a condition in a different method within the same Class based on the value of the variable "d" defined above.
However, I am not so sure how I can accomplish this task. Further, I could create the above calculating the value of "d" as a separate function within the same class and not so sure how to call it in another function passing the parameter values to evaluate the condition.
Could someone please help me with this issue?
Thank you in advance.
Kind regards,
Andrew