I see some minor problems here.
First, it is easier to do this in the Properties Sheet, not in code. Just select Column7, open the Properties Sheet, and change the property
ControlSource to
D1+D2+D3+D4.
Second, if you really want to do it in code, a .Valid() Event is not the correct place to do this. You can change the .ControlSource anywhere, but you need to do this only once - so you can just as well do it in .Column.Init(), or in Form.Init().
Third, if you assign a .ControlSource in code, you will have to use quotation marks:
...Column7.ControlSource = "D1+D2+D3+D4"But, I repeat, it is usually easier to assign the .ControlSource in the Property Sheet.
>hi,
>thank you for reply,
>i try as under but still no result
>
>at mygrid1.fieldname(d1).column3.headr.text1 procedure vaild i put this code under
>thisform.grid1.column7.controlsource=d1+d2+d3+d4
><pre>
>thanks.
>>>hi all,
>>>i try to make sum at my grid .but no result
>>>at mygrid column23 header 1 text1 via procedure valid
>>><pre>
>>>replace sum1 with d1+d2+d3+d4
>>>
>>>thanks
>>
>>If you want to have the sum of several fields in another Column, just put the sum (or other calculation) in the Column.ControlSource. For example, Grid.Column5.ControlSource =
D1 + D2 + D3 + D4
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)