以文本方式查看主题

-  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=177221)

--  作者:lds
--  发布时间:2022/5/13 10:17:00
--  [求助]
ListView窗口示例二十二中 一个人可以参加两个活动,怎么改成一个人只能参加一个活动?
Dim lvw As WinForm.ListView = e.Sender
If lvw.Rows.Count >= 20  AndAlso e.Source.Name <> lvw.Name Then \'如果已经有三人,而且是从其他ListView拖动过来.
    Messagebox.show("最多允许20!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
    e.Cancel = True \'取消本次拖动
    Return
End If
If e.Source.Name =  "ListView1" \'如果是从员工列表中拖过来的行
图片点击可在新窗口打开查看此主题相关图片如下:微信图片.png
图片点击可在新窗口打开查看
    e.Delete = False \'不要删除原来的项目
End If
Dim itm As WinForm.ListViewRow =  e.Source.Rows(e.OldIndex) \'获取要拖动过来的行
If e.Source.Name <> e.Sender.Name Then \'如果是从其他ListView中拖动过来的
    If e.Sender.Rows.Contains(itm.Name) \'判断活动一是否已经包括此员工
        MessageBox.Show("此店已经添加,无需重复添加!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
        e.Cancel = True \'取消本次拖动
    End If
End If

--  作者:有点蓝
--  发布时间:2022/5/13 11:02:00
--  
http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=50080

If e.Source.Name <> e.Sender.Name Then \'如果是从其他ListView中拖动过来的
    If e.Sender.Rows.Contains(itm.Name) 
\'
判断活动一是否已经包括此员工
        MessageBox.Show(
"
此员工已经报名参加活动一,无需重复报名!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
        
e.Cancel = True \'取消本次拖动
    End If
If e.Source.Name =  "ListView1" \'如果是从员工列表中拖过来的行
Dim lvw3 As WinForm.ListView = e.Form.Controls("ListView3"
    If lvw3.Rows.Contains(itm.Name) \'判断活动二是否已经包括此员工
        MessageBox.Show(
"
此员工已经报名参加活动二,无需重复报名!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
        
e.Cancel = True \'取消本次拖动
    End If
end if
End
 If
[此贴子已经被作者于2022/5/13 11:02:03编辑过]

--  作者:lds
--  发布时间:2022/5/13 11:09:00
--  
收到,谢谢!