True DBGrid created with control arrays and populating

True DBGrid created with control arrays and populating

Post by Brad » Sun, 31 Jan 1999 04:00:00



To All,

I am using vb 5.0 and True DBGrid 5.0.  I am creating new grids(one or more)
through a control array.  When I actually create the grid and make it
visible on the form, there is no data in it.  The original, that it was
created from of course has data.  I would like to at some point change the
record source for the data control that this new grid links to.  I thought
that when objects were created from a control array, those new objects
carried with them the properties, etc. from the original.  But still, the
new grid is not populated.  HELP!!! Any answers would be appreciated.  I
can't find anything in the online help or the book.

THANX

 
 
 

1. Oracle Data control and True DBGrid 5.0

We are using Oracle Objects for OLE Version 2.1.03.0 within Visual Basic
5.0 (SP3).
To display measured data a True DB Grid 5.0 control is used in
conjunction with the Oracle Data control. The grid control was
configured to fire the FetchCellStyle-Event for appearance formatting.
To increase performance of the FetchCellStyle procedure the use of a
clone to the ORADC recordset is recommended (as described in
TDBGrid-Handbook).
So we implemented the FetchCellStyle procedure as follows:

Private Sub TDBGrid1_FetchCellStyle(ByVal Condition As Integer, ByVal
Split As Integer, Bookmark As Variant, ByVal Col As Integer, ByVal
CellStyle As TrueDBGrid50.StyleDisp)
Dim Wert As Single
Dim CRec As Channel
Dim B    As Boolean
Dim F    As Object

    On Error Resume Next

'#######################################################################

    ORAClone.Bookmark = Bookmark   --> this line of code fails
!!!!!!!!!!!

'#######################################################################

    If Err.Number <> 0 Then
        Debug.Print Err.Description, CStr(ORAClone.Bookmark),
CStr(Bookmark)
        Exit Sub
    End If

    Set F = ORAClone.Fields(Col)

    If IsNull(F) Then Exit Sub
    Wert = CSng(F)
    CRec = UserData(Me.Tag).Chn(Col - 2)
    With CRec
        B = False
        If .VMin < .VMax Then
            If Wert < .VMin Or Wert > .VMax Then B = True
        Else
            If Wert > .VMin Or Wert < .VMax Then B = True
        End If
    End With
    CellStyle.BackColor = TDBGrid1.BackColor
    If B Then
        CellStyle.ForeColor = vbRed
        CellStyle.Font.Bold = True
    End If
End Sub

The opening of the recordset, the generation of the clone and the
binding of TDBGrid to the data control is done in the form load event:

        .....
        .ORADC1.RecordSource = SQL
        .ORADC1.Refresh
        Set ORAClone = .ORADC1.Recordset.Clone
        .TDBGrid1.Datasource = ORADC1
        .TDBGrid1.ClearFields
        ......

When running the program we always get the error message OIP-04121:
Invalid bookmark

Does anyone know what's wrong?
Response with EMail is prefered!

Thanx in advance

Martin

---------------------------------------------------
*  Ing. Martin Gamperl
*  MGS Softwareentwicklung
*  Klosterwiesgasse 31/IV
*  A-8010 GRAZ
*  Tel.    : +43-316-83 58 26
*  Fax     : +43-316-83 58 26
*  Mobil   : +43-664-40 03 032

---------------------------------------------------

2. Like with Variables and %

3. Help: True DBGrid Control

4. BCP & sa Login

5. GPF using True DBGrid with data control

6. Check constraint using sub-query

7. Can DBGrid be populated with the Recordset and not Data Control

8. ACT! and SQL Server

9. APEX True DBGrid vs. Sheridan DATA WIDGETS DBGrid

10. How to create a control array in the form designer

11. Creating an array of ActiveX controls.