在DBNavigator1中,
单击firtst,prior,next 等按钮时,
可以对数据库执行相应的操作。
我想另外新建几个Tbutton按钮,
然后分别调用DBNavigator1中的操作,可不可以这样做? 该怎么做呢?

解决方案 »

  1.   

    可以啊
    分别写上对应的代码就可以了
    dataset.first;//数据集指向第一条
    dataset.prior;//数据集指向当前的前一条
    dataset.next;//数据集指向当前的下一条
    dataset.last;//数据集指向最后一条
      

  2.   

    可以的,楼上的方法也行,不过,直接调用DBNavigator的方法也可:DBNavigator1.BtnClick(按钮);其中,按钮可为:按钮 按钮值 所执行操作First nbFirst Go to the first record
    Prior nbPrior Go to the previous record
    Next nbNext Go to the next record
    Last nbLast Go to the last record
    Insert nbInsert Insert a blank record
    Delete nbDelete Delete the current record
    Edit nbEdit Permit users to edit the current record
    Post nbPost Post the current record
    Cancel nbCancel Cancel the current edit
    Refresh nbRefresh Refresh the data in the dataset
    一个好方法是把DBNavigator的Visabled属性设置为False,自己在按钮的事件中调用它的方法。
      

  3.   

    感谢二位的支持,2楼的方法可行,
    3楼说的:"一个好方法是把DBNavigator的Visabled属性设置为False,自己在按钮的事件中调用它的方法。"
    我正是想这么做,方便,能省好多事。
    可是,
    我在按钮的onclick下加了代码 DBNavigator1.BtnClick(2);
    编译通不过,出现错误提示
    [Error]:Incompatible types: 'TNavigateBtn' and 'Integer'
    这是怎么回事,该怎么解决呢?
      

  4.   

    把数字改成按钮值
    nbFirst
    nbPrior
    nbNext
    nbLast
    nbInsert
    nbDelete
    nbEdit
    nbPost
    nbCancel
    Refresh