以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  求教:选定行为空时删除操作的处理  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=34953)

--  作者:huzidage
--  发布时间:2013/6/20 12:52:00
--  求教:选定行为空时删除操作的处理
删除按钮代码为:
If MessageBox.show("是否删除选定数据","提示",MessageBoxButtons.YesNo) =DialogResult.Yes Then
    With Tables("销售明细")
        For i As Integer = .BottomPosition To .TopPosition Step -1
            .Rows(i).Delete()
        Next
    End With  
End If

问题:当没选择数据行或表中数据为空时,点击删除按钮系统会出错误提示
求教:如何判断 是否选择数据行或表中数据为空,并弹出对话框提示。
谢谢!

--  作者:don
--  发布时间:2013/6/20 14:06:00
--  

If Tables("订单").Focused Then

  If Tables("订单").Current isnot nothing Then
       \'代码

     Else

        \'弹框提示

  End If

 Else

        \'弹框提示

End If


--  作者:Bin
--  发布时间:2013/6/20 14:06:00
--  
判断一下 if Tables("销售明细").current is nothing  then
--  作者:傻马难骑
--  发布时间:2013/6/20 15:19:00
--  
If MessageBox.show("是否删除选定数据","提示",MessageBoxButtons.YesNo) =DialogResult.Yes Then
    With Tables("销售明细")
        If .Current Is Nothing  Then
            For i As Integer = .BottomPosition To .TopPosition Step -1
                .Rows(i).Delete()
            Next
        End If
    End With
End If

--  作者:Bin
--  发布时间:2013/6/20 15:22:00
--  
以下是引用傻马难骑在2013-6-20 15:19:00的发言:
If MessageBox.show("是否删除选定数据","提示",MessageBoxButtons.YesNo) =DialogResult.Yes Then
    With Tables("销售明细")
        If .Current Is Nothing  Then
            For i As Integer = .BottomPosition To .TopPosition Step -1
                .Rows(i).Delete()
            Next
        End If
    End With
End If



是我大意误导了    If .Current Isnot Nothing  Then
--  作者:huzidage
--  发布时间:2013/6/20 15:44:00
--  
谢谢各位大侠不吝赐教!谢谢