If you would like to "remove" items from list which will not be used in shuffle, use
Enumerable.Except Method (System.Linq) | Microsoft Docs[
^]
Assuming that
Button1
refers to
Label1
,
Button2
refers to
Label2
and so on... all buttons should refer to the same event - like this:
Private Sub Button_Click(sender As Object, e As EventArgs)
Dim sName As String = DirectCast(sender, Button).Name
sName = sName.Replace("Button", "Label")
ignorelist.Add(sName)
shuffled = list.Except(ignorelist).OrderBy(Function(x) rnd.Next()).ToList()
End Sub
I'd suggest to declare
list
and
ignorelist
at the top of form's module.
Note: what happens when
ignorelist
will contain the same items as
list
?