以下代码是批量抽签,现在是想写一段单个抽签的代码,要求是:当选中一行后,只抽一个号,放在面试顺序列中,当再选中另一行后,还是只抽一个签,但原来已抽过的号,不再抽取,保证唯一,如何实现?谢谢
Dim cr2 As Row = Tables("人员抽取_人员").current
If cr2.IsNull("面试顺序") = False Then
MessageBox.Show("已抽签完毕,不能再抽取!","温馨提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
Return
End If
Dim dt As Table = Tables("人员抽取_人员")
Dim cnt As Integer = dt.Rows.Count
Dim ids(cnt -1) As Integer
For i As Integer = 0 To cnt -1
ids(i) = i
Next
For i As Integer = 0 To cnt \ 2 '洗牌次数
Dim id1 As Integer = rand.Next(0,cnt)
Dim id2 As Integer = rand.Next(0,cnt)
Dim vid As Integer = ids(id1)
ids(id1) = ids(id2)
ids(id2) = vid
Next
dt.StopRedraw()
For i As Integer = 0 To Tables("人员抽取_人员").Rows.count -1
Tables("人员抽取_人员").Rows(i)("面试顺序")=ids(i)+1
Next
dt.ResumeRedraw()
Tables("人员抽取_人员").save()