Thursday 15 September 2011

manually enter a subtotal value in a vb6 flexgrid -


I have a flexgrid with grouping, and one by that grouping. All columns except one are numeric, which is not one in the 'x / y' format, '1/5', i.e. 1 out of 5 items supplied.

If I do a Yoga with a flexX, then it shows the first number in the pair, that is, in the example given above, it shows 1 in the form of decimal and 1.00 in subtotal

First of all, I tried to find a way to collect the amount on one more column, that is, I can put different values ​​in different columns, Add these to the equivalent column of the first column, but I can not find any way to do this.

And even if I find a way to do this, then I want to be able to be in a custom format, subtle, then it appears as' 3/17 ', that means' Sub-totals of '3/17' in sub-total '1/5' and '2/12'

If I can not do it, I wonder if I can use the custom post line and manually enter sub-sum value of '3/17', but that too unavailable is.

My question is, what is the way to get it?

I think you are using VideoSoft FlexGrid which I never sed, so I Can not help you with specific methods of control

Although you can do it easily with a standard MSFlexGrid control, and maybe you can do this with the VideoSoftFlexGrid.

Take a look at the sample project:

  'with 1 form:' 1 Msflegrid control: Name = Msfaksgrid 1 choice clearly Private Sub Form_lod () Dim Elanjiaro Long MSFlexGrid1 as long as LNGOL .ows = 10 .Cols = 4 .FixedRows = 0 .FixedCols = 0 for lngRow = 0 .Rows to - 2 for lngCol = 0 .Col to - 2 .TextMatrix (lngRow, lngCol) CSTR (100 = * LngRow + lngCol) Next lngCol. TextMatrix (lngRow, .Cols - 1) = CSRR (LNGRO) & amp; "/" & Amp; CSTR (lngRow * lngRow) with Next lngRow and 'MSFlexGrid1 End Sub Private Sub Form_Resize () MSFlexGrid1.Move 0, 0, scalewidth, ScaleHeight End Sub Private Sub MSFlexGrid1_Click () Dim' subtotals MSFlexGrid1 long as lngCol with lngCol = 0 to calculate .Cols - 2 .TextMatrix (.Rows - 1, lngCol) = CSTR (GetTotal (lngCol)) Next LngCol KTextMatrix (KRows - L, KCols - L) = GetTotalSpecial (.Cols - 1) to finish with MSFlexGrid1 end sub Private function GetTotal (lngCol) long long MSFlexGrid1 lngTotal = 0 lngRow = 0 .Rows with as dim lngTotal long as dim lngRow For - 2 lngTotal = lngTotal + val (.exe TMatrix (lngRow, lngCol)) Next lngRow end 'MSFlexGrid1 GetTotal = lngTotal End Function Private Function GetTotalSpecial (to lngCol) as as string dim lngRow Long lngTotal2 as dim lngTotal1 Long, dim strPart long () As with string MSFlexGrid1 with lngTotal1 = 0 lngTotal2 = 0 to lngRow = 0. Lines - 2 Striprt = Split (. Text matrix (Elanjiaro, .COLS-1), "/") If Ubound (Striprt) = 1 then lngTotal1 = LngTotal1 + VAL (strPart (0)) lngTotal2 = lngTotal2 + VAL (StrPart ( 1)) End if the next lngRow end with 'MSFlexGrid1 GetTotalSpecial = CSTR (lngTotal1) & amp; "/" & Amp; CSRT (lngTotal2) and function   

This will load a grid with some values, and when you click on the grid, subtotals will be calculated and filled in the last line.

No comments:

Post a Comment