以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  编译错误“substring"不是”row"的成员  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=82192)

--  作者:cyrollin
--  发布时间:2016/3/13 14:45:00
--  编译错误“substring"不是”row"的成员
Dim Result As DialogResult
Dim rs As List (of Row) = CurrentTable().GetCheckedRows()
Dim ids As String
Result = MessageBox.Show("确定要删除 " & rs("产品名").substring(0,3)& " ?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.Yes Then
For Each r As Row In rs
ids = ids & "," & r("_Identify")
    r.Delete()
Next
Else
    Return
End If


图片点击可在新窗口打开查看此主题相关图片如下:qq图片20160313144406.png
图片点击可在新窗口打开查看


怎么修改啊?

----------------------
程序目的:删除所勾选的行
[此贴子已经被作者于2016/3/13 14:46:50编辑过]

--  作者:sjx71
--  发布时间:2016/3/13 18:09:00
--  
改为
Result = MessageBox.Show("确定要删除所选行么 ?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)

就行了

--  作者:czy
--  发布时间:2016/3/13 19:18:00
--  

如果一定要提示要删除的产品名称可以这样

 

Dim Result As DialogResult
Dim rs As List (of Row) = CurrentTable().GetCheckedRows()
Dim ids As String
For Each r As Row In rs
    ids = ids & "," & r("产品名")
Next
Result = MessageBox.Show("确定要删除 " & ids.Trim(",") & " ?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If Result = DialogResult.Yes Then
    For Each r As Row In rs
        r.Delete()
    Next
Else
    Return
End If


--  作者:cyrollin
--  发布时间:2016/3/14 14:38:00
--  
谢谢 CZY, 

如果没有勾选产品,直接按了删除键,会出现一个错误提示,我就加了下面代码?

Dim rb As Row = CurrentTable.current()
If rb.checked = False
messagebox.show("请选择需要删除的产品")
End If

但不对,怎么修改为好呢?

再次谢谢!

--  作者:czy
--  发布时间:2016/3/14 14:52:00
--  
Dim Result As DialogResult
Dim rs As List (of Row) = CurrentTable().GetCheckedRows()
Dim ids As String
For Each r As Row In rs
    ids = ids & "," & r("产品名")
Next
If ids > ""
    Result = MessageBox.Show("确定要删除 " & ids.Trim(",") & " ?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
    If Result = DialogResult.Yes Then
        For Each r As Row In rs
            r.Delete()
        Next
    End If
Else
    MessageBox.Show("请选择需要删除的产品")
End If

--  作者:czy
--  发布时间:2016/3/14 14:54:00
--  

Dim Result As DialogResult
Dim rs As List (of Row) = CurrentTable().GetCheckedRows()
If rs.Count = 0
    messagebox.show("请选择需要删除的产品")
    Return
End If

 

……原代码


--  作者:cyrollin
--  发布时间:2016/3/14 15:24:00
--  
goooooooooooooooooood, thanks