以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  到达第一条或最末条的提示弹窗怎么做  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=177404)

--  作者:min-fox
--  发布时间:2022/5/20 11:20:00
--  到达第一条或最末条的提示弹窗怎么做
蓝老师:
按钮第一条,上一条,下一条,最末条,如果已到达第一条,或最末条,继续点击第一条,或最末条,则弹出对话框提示,怎么做?
--  作者:有点蓝
--  发布时间:2022/5/20 11:29:00
--  
写了什么代码?
--  作者:min-fox
--  发布时间:2022/5/20 11:37:00
--  
不知如何写


--  作者:有点蓝
--  发布时间:2022/5/20 11:40:00
--  
http://www.foxtable.com/webhelp/topics/3300.htm
--  作者:狐狸爸爸
--  发布时间:2022/5/20 11:54:00
--  
加个判断就行了,以第一条为例:

With Tables("员工")
    If .Current IsNot Nothing AndAlso .Current.DataRow.RowState = DataRowState.Unchanged Then \'如果当前行未曾修改
        If .Position = 0 Then
            MessageBox.Show("已经是第一条", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Else
            .Position = 0
        End If
    End if
End With




--  作者:狐狸爸爸
--  发布时间:2022/5/20 11:56:00
--  
最末条也一样:

With Tables("员工")
    If .Current IsNot Nothing AndAlso .Current.DataRow.RowState = DataRowState.Unchanged Then \'如果当前行未曾修改
        If .Position = .Rows.Count - 1 Then
            MessageBox.Show("已经是最后一条!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Else
            .Position = .Rows.Count - 1
        End If
    End If
End With