P
Pascal
Hello
How to compare two list to know if they match?
LesNbresAverifier and MesNbres
On a form, I put 20 labels, 10 of them have have theit text property filled
from a list containing numbers:
Dim MesNbres As List(Of Object)
Dim i As Short = 0
MesNbres = utility.GenArrayNbres(min, max, RdBtnDecim.Checked, 10, True)
For Each C As MonLabel In TableLayoutPanel4.Controls
C.LblText = FormatNumber(MesNbres(i), 0, TriState.False, TriState.False,
TriState.True)
i += 1
Next
The content of these labels will be deposited by a DragDrop in the
remaining 10 labels. And it should comply with an ascending (or descending)
order.
I know how to order my list:
MesNbres.Sort()
Now I would like to compare this ordered list with the contents of the
10 labels who received the drop to see if they contained in ascending order
my 10 numbers. How do I do?
1) Do I create a list from labels.text then compare this list with
another (MesNbres)
Which method can I use to compare the two lists that will return
a false in the case of a difference between the two lists?
Here is the code to built the List from numbers in the labels
Private Function LblTxtToList()
Dim i As Integer
For Each C As MonLabel In TableLayoutPanel5.Controls
If C.LblText <> "" Then
LesNbresAverifier.Add(C.LblText)
i += 1
Else
Return MsgBox("You did'nt fill all the labels.",
MsgBoxStyle.Exclamation, "Attention")
C.Focus()
Exit Function
End If
Next
Return LesNbresAverifier
End Function
thank you
--
http://www.scalpa.info
http://scalpa-production.blogspot.com/
http://www.scalpa.info
http://scalpa98.blogspot.com/
How to compare two list to know if they match?
LesNbresAverifier and MesNbres
On a form, I put 20 labels, 10 of them have have theit text property filled
from a list containing numbers:
Dim MesNbres As List(Of Object)
Dim i As Short = 0
MesNbres = utility.GenArrayNbres(min, max, RdBtnDecim.Checked, 10, True)
For Each C As MonLabel In TableLayoutPanel4.Controls
C.LblText = FormatNumber(MesNbres(i), 0, TriState.False, TriState.False,
TriState.True)
i += 1
Next
The content of these labels will be deposited by a DragDrop in the
remaining 10 labels. And it should comply with an ascending (or descending)
order.
I know how to order my list:
MesNbres.Sort()
Now I would like to compare this ordered list with the contents of the
10 labels who received the drop to see if they contained in ascending order
my 10 numbers. How do I do?
1) Do I create a list from labels.text then compare this list with
another (MesNbres)
Which method can I use to compare the two lists that will return
a false in the case of a difference between the two lists?
Here is the code to built the List from numbers in the labels
Private Function LblTxtToList()
Dim i As Integer
For Each C As MonLabel In TableLayoutPanel5.Controls
If C.LblText <> "" Then
LesNbresAverifier.Add(C.LblText)
i += 1
Else
Return MsgBox("You did'nt fill all the labels.",
MsgBoxStyle.Exclamation, "Attention")
C.Focus()
Exit Function
End If
Next
Return LesNbresAverifier
End Function
thank you
--
http://www.scalpa.info
http://scalpa-production.blogspot.com/
http://www.scalpa.info
http://scalpa98.blogspot.com/