PDA

Click to See Complete Forum and Search --> : Flex Grid Extract


Tee Jay
Aug 10th, 2000, 04:08 AM
Hi,

I have added data to an MSFlexgrid using the "addrow" option and am now trying to extract that data, filter it and then stick it in another flexgrid, this is where I'm stumped, completely in fact and any assistance would be appreciated.

My data is in the following format:

C0 C1 C2 C3 C4
R1 180 1.01 2.1 -1.5
R2 180 0.99 2.0 -1.5
R3 180 1.10 2.2 -1.5
R4 180 0.87 1.9 -2.2
R5 180 0.95 1.8 -2.2
R6 180 1.20 1.9 -2.2


what I'm trying to do is to run a query on the msflexgrid which will provide me with the average sqrt of (C2 sqr + C3 sqr) when the C4 values are the same and then dump this value out to another msflexgrid with the C4 value to which it applies ie

Ave. squareroot of (C2 sq+c3 sq) = "2.34" where C4 = "-1.5"
Ave. squareroot of (C2 sq+c3 sq) = "3.39" where C4 = "-2.2"
and so on for whatever values of C4 occur within the msflexgrid.

In addition to this I also want to display the C2, C3, C4 values from the msflexgrid on an xy scatter chart, the trouble is I may have up to 280,000 lines of input which seems to clog things up somewhat.

Any help would be really appreciated as I'm stumped and my book doesn't help.

Cheers

Tee Jay

Paul Warren
Aug 11th, 2000, 04:49 AM
Tee Jay - Is this any use to you :


Private GridData() As Single

Private Sub Form_Load()

Dim iTemp1 As Integer
Dim iTemp2 As Integer

ReDim GridData(MSFlexGrid1.Rows, MSFlexGrid1.Cols)

For iTemp1 = 0 To MSFlexGrid1.Rows - 1
For iTemp2 = 0 To MSFlexGrid1.Cols - 1
GridData(iTemp1, iTemp2) = Val(MSFlexGrid1.TextMatrix(iTemp1, iTemp2)) ' Save the value for manipulation
Next iTemp2
Next iTemp1

Do_Transformation

For iTemp1 = 0 To MSFlexGrid1.Rows - 1
For iTemp2 = 0 To MSFlexGrid1.Cols - 1
MSFlexGrid2.TextMatrix(iTemp1, iTemp2) = GridData(iTemp1, iTemp2) ' Write the new value into the flexgrid
Next iTemp2
Next iTemp1

End Sub

Private Sub Do_Transformation()

' Do your calculations here

End Sub

Tee Jay
Aug 14th, 2000, 12:31 AM
Hi Paul,

Thanks allot I'll give it a go

Cheers

Tee Jay