TDBGrid1当属性DataMode设置为4-Storage时TDBGrid1的属性Array为什么只能用在Form_Load中?
语句:Public x As New XArrayDB
      x.ReDim 0, 50, 0, 3
      Set TDBGrid1.Array = x
只能在Form_Load中有效,能否用在别的事件中呢?感谢!

解决方案 »

  1.   

    当然可以用在别的地方。我在很多事件中用过,比如text1_keydown ,combo1_click都有效果的。
    还有为什么不定义成这样:
          private x As New XArray----------------------------
          set x=new xarray
          x.autoredim=true
          x.ReDim 0, 50, 0, 3
          Set TDBGrid1.Array = x
          tdbgrid1.rebind
      

  2.   

    flyahead0你好:
        首先谢谢你的回答,我用了你的代码复制到命令按钮中,要点击两下才执行出现表格,为什么?非常感谢!!!
      

  3.   

    当然可以,
    我用了两年多了
    dim x As New XArray
    x.ReDim 0, 50, 0, 3
    for i =0 to 50
      for j = 0 to 3
        x(i,j) = i & j
      next j
    next i  
    tdbgrid1.movefirst
    Set TDBGrid1.Array = x
    tdbgrid1.rebind
    tdbgrid1.refresh