CuriousGuy
Member
- Joined
- Aug 8, 2022
- Messages
- 7
- Programming Experience
- 1-3
topic can be closed.
Last edited:
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).So what? Who says you have to add that data directly to the grid rather than to a data source? You could use anotherPoint 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.
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.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.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.