1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| Public Class Form2
Private MyItems As Dictionary(Of Int32, Item)
Private Seq As String = "MKKMQSIVHAL"
Private Sub Form2_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
MyItems = GetDictionary()
End Sub
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
Dim s As String = Seq(0)
SearchSeq(s)
End Sub
Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
Dim s As String = Seq(1)
SearchSeq(s)
End Sub
Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
Dim s As String = Seq(4)
SearchSeq(s)
End Sub
Private Sub SearchSeq(seq As String)
Label3.Text = "Non"
LabelName.Text = "neant"
For i = 0 To MyItems.Count - 1
txt_ipc.Text = MyItems.Count.ToString
If MyItems(i).Name = seq Then
Label3.Text = "Oui"
LabelName.Text = MyItems(i).Name
Dim getCarac As String = MyItems.Keys(i)
Exit For
End If
Next
End Sub
Private Function GetDictionary() As Dictionary(Of Int32, Item)
Dim dictItems As New Dictionary(Of Int32, Item)
dictItems.Add(0, New Item With {.Name = "K", .Param1 = 3.5, .Param2 = 9.8, .Param3 = 10.3})
dictItems.Add(1, New Item With {.Name = "R", .Param1 = 11.5, .Param2 = 12.5, .Param3 = 11.5})
dictItems.Add(2, New Item With {.Name = "H", .Param1 = 4.89, .Param2 = 6.08, .Param3 = 6.89})
dictItems.Add(3, New Item With {.Name = "M", .Param1 = 4.89, .Param2 = 6.08, .Param3 = 6.89})
Return dictItems
End Function
Private Class Item
Public Property Name As String
Public Property Param1 As Double
Public Property Param2 As Double
Public Property Param3 As Double
End Class
Private Class Items
Inherits List(Of Items)
End Class
End Class |
Partager