A little update problem...

You would need to add code to recompute the new sum. Although the data grid view may in some ways look like Excel, it is not Excel. It knows nothing about formulas, so it will not know to recompute things. You will need to implement the code to recompute and putting the result into your textbox.
 
Rather than adding data directly to the grid, it's generally better to use data-binding. If you're working with a database, it's common to populate a DataTable and bind that, preferably through a BindingSource. In your case, you could then handle the appropriate events of the BindingSource to know when data has or may have changed, then run code to update the TextBox, maybe calling the Compute method of the DataTable. If you have no data source then you need to handle appropriate events of the grid itself to know when to update your computed value(s).
 
Point is, the data wich i pick from the first dataGrid at Form2 comes from a database but the dataGrid at Form1 is an Empty dataGrid. It just store the data which comes from Form2.
So what? Who says you have to add that data directly to the grid rather than to a data source? You could use another DataTable or a list of some custom type. You can add the data to the grid directly if you want to, which just means that you then need to perform the appropriate calculation on that data in the grid to get your aggregate value. Of course, if the data is supposed to be numeric then one has to wonder why you're adding strings to the grid.
 
My question was just to get an idea how i could add a function behind the dataGrid at Form1 to update the total amount in my TextBox.
It's not behind the grid. It's in the form. Write a method that loops over the grid and sums the data. Call that method after making a change to the grid.
 
Back
Top Bottom