We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Summing DataBoundGrid column values

I have attempted every way I can imagine to sum the column values in a DataBoundGrid and I am getting no where. I have a Master-Detail type form in VB that displays four columns in a grid. I tried to programmatically set up the grid as Master-Detail, but the data member value would not take. I ended up setting the Data Value Member in the Grid properties to make it work. The row count varies with each transaction number. I would like to sum the values of the fourth column and display that sum in a text box whenever the master transaction number changes. I inserted a GridAwareTextBox, but I cannot find any documentation for it. Can you please guide me to a method that will get the results I need?

7 Replies

AD Administrator Syncfusion Team February 13, 2004 11:19 PM UTC

I am not clear on what you are describing as far as the Master-Details goes. What comes to mid for me is 2 grids, a master grid and a details grid. Clicking in the master, sets the data in teh details. If you set things up using a DataSet with two DataTables and a Relation, then you can implement a Master-Details as two grid by setting DataSource/DataMember on the grids. Here is a sample that shows master-details-details (three grids and two relations). Here is that sample modified with a column of numbers in each grid, and labels on the form holding the sum of those columns. It does this by adding up the values whenever you type into one of the columns, or when you cahnge the parent grid (forcing new content into the child grid). TripleMasterDetailsWithSum_8627.zip


WG Wes Goad February 17, 2004 10:51 AM UTC

You are correct about the Master-Detail I have set up. As the transaction number changes, the grid is filled with the information based on a relationship. My problem is that once the data is filled in the grid, I would like to sum the values and put the summed value in a textbox. I converted a VB 6.0 program to VB.net. The former version had the Flexgrid which I used to sum the values and place the summed value in a textbox. All of my code is written to respond to the value in the textbox. I purchased the Sycnfusion product because I understood that it would provide me the opportunity to do the same. I just can''t find the right syntax in my code to perform this.


AD Administrator Syncfusion Team February 17, 2004 11:40 AM UTC

Is there some reason the code in the sample I sent will not serve your purpose? The sample uses a Label, but you can change it to a TextBox.


WG Wes Goad February 17, 2004 12:12 PM UTC

It should work great, except I was wondering if you have that in VB Code? >Is there some reason the code in the sample I sent will not serve your purpose? The sample uses a Label, but you can change it to a TextBox.


AD Administrator Syncfusion Team February 17, 2004 12:28 PM UTC

Here it is in VB.


AD Administrator Syncfusion Team February 17, 2004 12:30 PM UTC

Sorry. I clicked the wrong button. Here it is in VB.


WG Wes Goad February 17, 2004 06:08 PM UTC

That did it! Thanks for your help.

Loader.
Up arrow icon