Error in TrueDBGrid80.TDBGrid

Posted by: rrodriguez on 29 December 2017, 1:27 pm EST

    • Post Options:
    • Link

    Posted 29 December 2017, 1:27 pm EST

    Hello:

      I am still using Visual Basic 6.
    
      Recently I manually modified original .frm file to convert TrueDBGridStd.TDBGridS to TrueDBGrid80.TDBGrid.  TrueDBGridStd.TDBGridS is a very very old control, at least 20 years old.
    
     I added the lines from _ExtentX to end
    
     My program works fine with TrueDBGridStd.TDBGridS  By after I manually modified my original .frm file, I have the running error of type mismatch for the following line.
        Set Col0 = frmMain!DataGrid(i).Columns(0)
    
     Col0 is defined as Column.
        Dim Col0 As Column, Col1 As Column, Col2 As Column
    
     I is 0 when error occurs and did check form frmMain and DataGrid(0) did exist.
     Can anyone give me a hint how to solve the error?
    
     Thanks!
    
     Qingyi 
    
    
               Begin TrueDBGrid80.TDBGrid DataGrid 
                     Height          =   4560
                     Index           =   0
                     Left            =   90
                     TabIndex        =   87
                     Top             =   90
                     Width           =   8325
      		     _ExtentX        =   2566
      		     _ExtentY        =   1931
      		     _LayoutType     =   0
      		     _RowHeight      =   -2147483647
      		     _WasPersistedAsPixels=   0
      		     Columns(0)._VlistStyle=   0
      		     Columns(0)._MaxComboItems=   5
      		     Columns(0).DataField=   ""
      		     Columns(0)._PropDict=   "_MaxComboItems,516,2;_VlistStyle,514,3"
      		     Columns(1)._VlistStyle=   0
      		     Columns(1)._MaxComboItems=   5
      		     Columns(1).DataField=   ""
      		     Columns(1)._PropDict=   "_MaxComboItems,516,2;_VlistStyle,514,3"
      		     Columns.Count   =   2
      		     Splits(0)._UserFlags=   0
      		     Splits(0).RecordSelectorWidth=   979
      		     Splits(0).DividerColor=   15790320
      		     Splits(0).SpringMode=   0   'False
      		     Splits(0)._PropDict=   "_ColumnProps,515,0;_UserFlags,518,3"
      		     Splits(0)._ColumnProps(0)=   "Columns.Count=2"
      		     Splits(0)._ColumnProps(1)=   "Column(0).Width=2725"
      		     Splits(0)._ColumnProps(2)=   "Column(0).DividerColor=0"
      		     Splits(0)._ColumnProps(3)=   "Column(0)._WidthInPix=2646"
      		     Splits(0)._ColumnProps(4)=   "Column(0).Order=1"
      		     Splits(0)._ColumnProps(5)=   "Column(1).Width=2725"
      		     Splits(0)._ColumnProps(6)=   "Column(1).DividerColor=0"
      		     Splits(0)._ColumnProps(7)=   "Column(1)._WidthInPix=2646"
      		     Splits(0)._ColumnProps(8)=   "Column(1).Order=2"
      		     Splits.Count    =   1
      		     PrintInfos(0)._StateFlags=   0
      		     PrintInfos(0).PageHeaderFont=   "Size=8.25,Charset=0,Weight=400,Underline=0,Italic=0,Strikethrough=0,Name=MS Sans Serif"
      		     PrintInfos(0).PageFooterFont=   "Size=8.25,Charset=0,Weight=400,Underline=0,Italic=0,Strikethrough=0,Name=MS Sans Serif"
      		     PrintInfos(0).PageHeaderHeight=   0
      		     PrintInfos(0).PageFooterHeight=   0
      		     PrintInfos.Count=   1
      		     DefColWidth     =   0
      		     HeadLines       =   1
      		     FootLines       =   1
      		     MultipleLines   =   0
      		     CellTipsWidth   =   0
      		     DeadAreaBackColor=   15790320
      		     RowDividerColor =   15790320
      		     RowSubDividerColor=   15790320
      		     DirectionAfterEnter=   1
      		     DirectionAfterTab=   1
      		     MaxRows         =   250000
      		     _PropDict       =   "_ExtentX,2003,3;_ExtentY,2004,3;_LayoutType,512,2;_RowHeight,16,3;_StyleDefs,513,0;_WasPersistedAsPixels,516,2"
      		     _StyleDefs(0)   =   "_StyleRoot:id=0,.parent=-1,.alignment=3,.valignment=0,.bgcolor=&H80000005&"
      		     _StyleDefs(1)   =   ":id=0,.fgcolor=&H80000008&,.wraptext=0,.locked=0,.transparentBmp=0"
      		     _StyleDefs(2)   =   ":id=0,.fgpicPosition=0,.bgpicMode=0,.appearance=0,.borderSize=0,.ellipsis=0"
      		     _StyleDefs(3)   =   ":id=0,.borderColor=&H80000005&,.borderType=0,.bold=0,.fontsize=825,.italic=0"
      		     _StyleDefs(4)   =   ":id=0,.underline=0,.strikethrough=0,.charset=0"
      		     _StyleDefs(5)   =   ":id=0,.fontname=MS Sans Serif"
      		     _StyleDefs(6)   =   "Style:id=1,.parent=0,.namedParent=33"
      		     _StyleDefs(7)   =   "CaptionStyle:id=4,.parent=2,.namedParent=37"
      		     _StyleDefs(8)   =   "HeadingStyle:id=2,.parent=1,.namedParent=34"
      		     _StyleDefs(9)   =   "FooterStyle:id=3,.parent=1,.namedParent=35"
      		     _StyleDefs(10)  =   "InactiveStyle:id=5,.parent=2,.bgcolor=&H8000000F&,.fgcolor=&H80000012&"
      		     _StyleDefs(11)  =   "SelectedStyle:id=6,.parent=1,.namedParent=36"
      		     _StyleDefs(12)  =   "EditorStyle:id=7,.parent=1"
      		     _StyleDefs(13)  =   "HighlightRowStyle:id=8,.parent=1,.namedParent=38"
      		     _StyleDefs(14)  =   "EvenRowStyle:id=9,.parent=1,.namedParent=39"
      		     _StyleDefs(15)  =   "OddRowStyle:id=10,.parent=1,.namedParent=40"
      		     _StyleDefs(16)  =   "RecordSelectorStyle:id=11,.parent=2,.namedParent=41"
      		     _StyleDefs(17)  =   "FilterBarStyle:id=12,.parent=1,.namedParent=42"
      		     _StyleDefs(18)  =   "Splits(0).Style:id=13,.parent=1"
      		     _StyleDefs(19)  =   "Splits(0).CaptionStyle:id=22,.parent=4"
      		     _StyleDefs(20)  =   "Splits(0).HeadingStyle:id=14,.parent=2"
      		     _StyleDefs(21)  =   "Splits(0).FooterStyle:id=15,.parent=3"
      		     _StyleDefs(22)  =   "Splits(0).InactiveStyle:id=16,.parent=5"
      		     _StyleDefs(23)  =   "Splits(0).SelectedStyle:id=18,.parent=6"
      		     _StyleDefs(24)  =   "Splits(0).EditorStyle:id=17,.parent=7"
      		     _StyleDefs(25)  =   "Splits(0).HighlightRowStyle:id=19,.parent=8"
      		     _StyleDefs(26)  =   "Splits(0).EvenRowStyle:id=20,.parent=9"
      		     _StyleDefs(27)  =   "Splits(0).OddRowStyle:id=21,.parent=10"
      		     _StyleDefs(28)  =   "Splits(0).RecordSelectorStyle:id=23,.parent=11"
      		     _StyleDefs(29)  =   "Splits(0).FilterBarStyle:id=24,.parent=12"
      		     _StyleDefs(30)  =   "Splits(0).Columns(0).Style:id=28,.parent=13"
      		     _StyleDefs(31)  =   "Splits(0).Columns(0).HeadingStyle:id=25,.parent=14"
      		     _StyleDefs(32)  =   "Splits(0).Columns(0).FooterStyle:id=26,.parent=15"
      		     _StyleDefs(33)  =   "Splits(0).Columns(0).EditorStyle:id=27,.parent=17"
      		     _StyleDefs(34)  =   "Splits(0).Columns(1).Style:id=32,.parent=13"
      		     _StyleDefs(35)  =   "Splits(0).Columns(1).HeadingStyle:id=29,.parent=14"
      		     _StyleDefs(36)  =   "Splits(0).Columns(1).FooterStyle:id=30,.parent=15"
      		     _StyleDefs(37)  =   "Splits(0).Columns(1).EditorStyle:id=31,.parent=17"
      		     _StyleDefs(38)  =   "Named:id=33:Normal"
      		     _StyleDefs(39)  =   ":id=33,.parent=0"
      		     _StyleDefs(40)  =   "Named:id=34:Heading"
      		     _StyleDefs(41)  =   ":id=34,.parent=33,.valignment=2,.bgcolor=&H8000000F&,.fgcolor=&H80000012&"
      		     _StyleDefs(42)  =   ":id=34,.wraptext=-1"
      		     _StyleDefs(43)  =   "Named:id=35:Footing"
      		     _StyleDefs(44)  =   ":id=35,.parent=33,.valignment=2,.bgcolor=&H8000000F&,.fgcolor=&H80000012&"
      		     _StyleDefs(45)  =   "Named:id=36:Selected"
      		     _StyleDefs(46)  =   ":id=36,.parent=33,.bgcolor=&H8000000D&,.fgcolor=&H8000000E&"
      		     _StyleDefs(47)  =   "Named:id=37:Caption"
      		     _StyleDefs(48)  =   ":id=37,.parent=34,.alignment=2"
      		     _StyleDefs(49)  =   "Named:id=38:HighlightRow"
      		     _StyleDefs(50)  =   ":id=38,.parent=33,.bgcolor=&H8000000D&,.fgcolor=&H8000000E&"
      		     _StyleDefs(51)  =   "Named:id=39:EvenRow"
      		     _StyleDefs(52)  =   ":id=39,.parent=33,.bgcolor=&HFFFF00&"
      		     _StyleDefs(53)  =   "Named:id=40:OddRow"
      		     _StyleDefs(54)  =   ":id=40,.parent=33"
      		     _StyleDefs(55)  =   "Named:id=41:RecordSelector"
      		     _StyleDefs(56)  =   ":id=41,.parent=34"
      		     _StyleDefs(57)  =   "Named:id=42:FilterBar"
      		     _StyleDefs(58)  =   ":id=42,.parent=33"
                  End
    
  • Posted 30 December 2017, 8:32 am EST

    I made the following modification and the error disappears.

    old —> Dim Col0 As Column

    new —> Dim Col0 As TrueDBGrid80.Column

    Now when I run to the following line, I have another error message. Run-time error 6149: Invalid bookmark. If anyone can give me an advice, thanks!

    For i = 0 To 5

    frmMain!DataGrid(i).FirstRow = True

    Next i

  • Posted 2 January 2018, 9:18 pm EST

    Hi,

    We are glad to know that you were able to resolve the first issue for you.

    Regarding the error 6149, could you try replacing your code snippet with the following:

    Dim bkmrk As Long
    bkmrk = 6
    TDBGrid1.FirstRow = bkmrk
    

    Let me know if this does not works.

    Thanks,

    Ruchir Agarwal

  • Posted 3 January 2018, 11:38 am EST

    Ruchir:

     It still has the same error message:Run-time error 6149: Invalid bookmark
     The following is part of the code
    
     Thanks!
    

    Private Sub DataGridInit()

    Dim i As Integer

    Dim j As Long

    Dim Col0 As TrueDBGrid80.Column, Col1 As TrueDBGrid80.Column, Col2 As TrueDBGrid80.Column

    Dim bkmrk As Long

    bkmrk = 6
    For i = 0 To 5
        frmMain!DataGrid(i).FirstRow = bkmrk
    Next i
    
    For i = 7 To 9
        frmMain!DataGrid(i).FirstRow = bkmrk
    Next i
        
        frmMain!DataGrid(11).FirstRow = bkmrk
    

    End Sub

  • Posted 3 January 2018, 11:47 am EST

    Ruchir:

      I have another error message for line: Col0.rebind
      The error message is: does not support this method or property
    
            For j = 1 To 3
              Set Col0 = frmMain!OutputGrid(i).Columns.Add(j + 1)
    

    → this line Col0.ReBind

    Col0.Visible = True

    Next j

  • Posted 5 January 2018, 1:34 am EST

    Hello,

    Regarding the error: Run-time error 6149: Invalid bookmark: We suggest you to try the following code:

    Dim S As TrueDBGrid80.Split
    Set S = TDBGrid1.Splits.Add(0)
    Set S = TDBGrid1.Splits.Add(0)
    For i = 0 To 2
        Form1!TDBGrid1.[b]Splits(i)[/b].FirstRow = [b]"3"[/b]
    Next i
    
    

    Regarding the error: Does not support this method or property: We suggest you to replace ReBind method with Refetch method, as follows:

    For j = 1 To 3
    	Set Col0 = Form1!TDBGrid1.Columns.Add(j+1)
    	Col0.[b]Refetch[/b]
    	Col0.Visible = True
    Next j
    

    Do let me know if they helped.

    ~Ruchir Agarwal

  • Posted 6 January 2018, 11:35 am EST

    Ruchir:

    I updated my code based on your advise.
    But I still have error:
      run-time error "6149"
      application-defined or object-defined error
    Can you please tell what is wrong?
    
    Also what is the difference between Refresh method and Rebind method?
    Thanks!
    
    For i = 0 To 5
        Set s = frmMain!DataGrid(i).Splits.Add(0)
        Set s = frmMain!DataGrid(i).Splits.Add(0)
        For k = 0 To 2
          frmMain!DataGrid(i).Splits(k).FirstRow = "3"
        Next k
    Next i
    
  • Posted 6 January 2018, 11:35 am EST

    Ruchir:

    I updated my code based on your advise.
    But I still have error:
      run-time error "6149"
      application-defined or object-defined error
    Can you please tell what is wrong?
    
    Also what is the difference between Refresh method and Rebind method?
    Thanks!
    
    For i = 0 To 5
        Set s = frmMain!DataGrid(i).Splits.Add(0)
        Set s = frmMain!DataGrid(i).Splits.Add(0)
        For k = 0 To 2
          frmMain!DataGrid(i).Splits(k).FirstRow = "3"
        Next k
    Next i
    
  • Posted 7 January 2018, 11:24 pm EST

    Hello,

    We are discussing the case with concerned developer [Tracking ID: 304140].

    Meanwhile, could you please share information on why you are using following statement:

    frmMain!DataGrid(i)
    

    and suggest you to replace your following code:

    For i = 0 To 5
    Set s = frmMain!DataGrid(i).Splits.Add(0)
    Set s = frmMain!DataGrid(i).Splits.Add(0)
    For k = 0 To 2
    frmMain!DataGrid(i).Splits(k).FirstRow = "3"
    Next k
    Next i
    

    with

    Dim S As TrueDBGrid80.Split
    Set S = TDBGrid1.Splits.Add(0)
    Set S = TDBGrid1.Splits.Add(0)
    For i = 0 To 2
        Form1!TDBGrid1.Splits(i).FirstRow = "3"
    Next i
    

    ~Ruchir

  • Posted 8 January 2018, 2:34 pm EST

    Ruchir:

      The code worked.  But it now has 3 splits. That is not what I want. 
       I am trying to read manual book to see what is the purpose of FirRow property for. Can you explain it briefly? If I delete the code, what will happen?
    

    ’ For i = 0 To 5

    ’ frmMain!DataGrid(i).FirstRow = True

    ’ Next i

    ’ For i = 7 To 9

    ’ frmMain!DataGrid(i).FirstRow = True

    ’ Next i

    ’ frmMain!DataGrid(11).FirstRow = True

    if I remove the above code, the program moves on. Now I have a type unmatch error on the line of:

    Set SelBks = frmMain!OutputGrid(3).SelBookmarks

    I am moving from truedbgridstd.tdbgrids. It looks that there are some change that I need to modify manually. Sorry to ask for so many questions. Thanks!

    Private Sub OutputGrid_DblClick(Index As Integer)

    Dim msg$, ANS$

    Dim mark As String

    Dim i As Integer, j As Integer, posn As Integer

    Dim SelBks As SelBookmarks

    If Index = 6 Then

     cmndResinSort_Click (1)
     
     Set SelBks = frmMain!OutputGrid(3).SelBookmarks
    
  • Posted 8 January 2018, 9:13 pm EST

    Hello,

    Regarding frmMain!DataGrid(i), we are not able to understand why are you using this statement ! Are you trying to access a grid among the multiple grids placed on your form or something as such? In order to provide you to the code snippet for the TrueDbGrid8 we need this information.

    FirstRow property is used for setting the first visible row. Setting this property causes grid to scroll so that a specific row becomes topmost row.

    Its usage:

    Dim bk As Variant
    TDBGrid1.MoveFirst
    bk = TDBGrid1.GetBookmark(4)
    'With TrueDbGrid
    TDBGrid1.FirstRow = bk
    
    'With Splits in TrueDbGrid8
    Dim S As TrueDBGrid80.Split
    Set S = TDBGrid1.Splits.Add(0) 
    Set S = TDBGrid1.Splits.Add(0)
    For i = 0 To 2
        Form1!TDBGrid1.Splits(i).FirstRow = bk
    Next i
    

    You may access detailed information using following documentation page: http://help.grapecity.com/componentone/NetHelp/truedbgrid8/firstrowproperty.html

    So, if you delete code for this property, you will see a grid with its first top row same as that in your datasource.

    Now, regarding the error with SelBookmarks, you may use following code:

    Dim sb As SelBookmarks
    Set sb = TDBGrid1.SelBookmarks
    

    Also, we request you to share the version of TrueDBGrid you are using, having that information would help us assist you better in migrating your project to TrueDBgrid8.

    Thanks,

    Ruchir Agarwal

  • Posted 10 January 2018, 12:37 pm EST

    Ruchir:

    If I change Dim sb As SelBookmarks to Dim sb As TrueDBGrid80.SelBookmarks, the error disappears

    Now my only error is FirstRow property.

    Every time I run my program, cursor does not go to the first row

    ’ For i = 0 To 5

    ’ frmMain!DataGrid(i).FirstRow = True

    ’ Next i

    I am using tdbg8.ocx version 8.0.20163.374

    Thanks for help!

  • Posted 10 January 2018, 1:42 pm EST

    I have one error regarding chart2D control.

    It says variable is not defined. graphLegendTop is not defined.

    I manually changed old Chart2D to new version

    I use olch2x8.ocx version 8.0.20163.98

    ParamProcessGraph2.LegendPos = graphLegendTop

  • Posted 10 January 2018, 8:59 pm EST

    Hi,

    Thank you for letting us know that the error related to SelBookmarks is now resolved.

    Regarding, on how to show cursor in the first row upon execution: For this you just need to use the following code:

    TDBGrid1.MoveFirst
    TDBGrid1.EditActive=True
    

    Note: There is no need of using the following code snippet that you were using till now, for the purpose of showing cursor in first row.

    For i = 0 To 5
    frmMain!DataGrid(i).FirstRow = True
    Next i
    

    Regarding the version information, I am sorry that I was not clear enough earlier. What we need is the version information of the TrueDBGrid from which you are migrating to TrueDBGrid8.

    Regarding the new error you are observing related to Chart2D, you may specify the Chart’s Legend position by using Anchor property as follows:

    [b]Chart2D1.Legend.Anchor=oc2dAnchorNorth
    [/b]
    

    For more information on this, please refer following documentation page: http://help.grapecity.com/componentone/NetHelp/chart82d/legendpositioning2.html

    Thanks,

    Ruchir Agarwal

    *Note: We request you to start a new forum post for non-related issues, as having separate cases for separate issues helps in supervision and also increases our efficiency to respond to it.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels