13-01-17, 04:38 PM
وهذه طريقة أخرى باستخدام كلاس للحقول مثل هذا الكود
ولإضافة البيانات لها مثل هذا الكود
ولقراءة البيانات مثل هذا الكود
أو
وفي حالة البحث واظهار النتيجة مثل هذا الكود
كود :
Private testlist As New List(Of test)
Class test
Property ID As String
Property Username As String
Property Key As String
Property Key2 As String
Property JoinDate As String
Property LeftDate As String
Property Zone As String
End Classولإضافة البيانات لها مثل هذا الكود
كود :
testlist.Add(New test With {
.ID = "1", .Username = "vb4arb0",
.Key = "556", .Key2 = "101",
.JoinDate = "2017/10/02 14:37:24",
.LeftDate = "2017/10/02 15:37:24",
.Zone = "0"}
)ولقراءة البيانات مثل هذا الكود
كود :
MsgBox(testlist(0).ID)
MsgBox(testlist(0).Username)كود :
Dim tst As test = testlist(0)
MsgBox(tst.ID)
MsgBox(tst.Username)وفي حالة البحث واظهار النتيجة مثل هذا الكود
كود :
Dim tst = testlist.Where(Function(t) t.ID = 1).FirstOrDefault
If tst IsNot Nothing Then
MsgBox(tst.JoinDate)
MsgBox(tst.LeftDate)
Else
MsgBox("لا يوجد")
End If

