datagridtextbox column text changed event problem
-
hello sir , my problem is that my datagrid have 3 datagridtextbox columns value1 value2 total now i want to calculate total while entering data in value or value1 while using userdefine event finally realized that it works on a plain TextBox and not within a TextBox with a DataGrid. thank u.
-
hello sir , my problem is that my datagrid have 3 datagridtextbox columns value1 value2 total now i want to calculate total while entering data in value or value1 while using userdefine event finally realized that it works on a plain TextBox and not within a TextBox with a DataGrid. thank u.
-
thanks for ur response actually i am using datagrid control my problem is not to sum data but to calculate it in other cell while editing
-
hello sir , my problem is that my datagrid have 3 datagridtextbox columns value1 value2 total now i want to calculate total while entering data in value or value1 while using userdefine event finally realized that it works on a plain TextBox and not within a TextBox with a DataGrid. thank u.
There is a very correct option in doing this. first create a class having three private float variable amount1, amount2, total. Now create getter setters of all of them. the class should look like this. public class Temp { //private members private float num1 = 0; private float num2 = 0; private float total; //Public members public float Num1 { get; set; } public float Num2 { get; set; } public float Total { get { return Num1 * Num2; } //Dont keep setter as Total should be read only. } } Now in your form.cs file just bind the list of this class to the datagrid you want List temps = new List(); datagridview1.DataSource = temps; Compile it... Whenever you change the value of Num1 and Num2, Total will automatically get changed.