17-12-12, 01:19 AM
السلام عليكم ورحمة الله وبركاته
استخدم List (Of فهي متقدمة ومرنة أكثر من المصفوفة التقليدية، وتعامل معها كما تتعامل مع Items التي تخص ListBox أو ComboBox من حيث الإضافة والحذف والإدراج في وسطها إلخ...، وإليك مثال جربه
طبعا الـ (Class Point3d) هو يكتب مرة واحدة فقط..
السلام عليكم ورحمة الله وبركاته
استخدم List (Of فهي متقدمة ومرنة أكثر من المصفوفة التقليدية، وتعامل معها كما تتعامل مع Items التي تخص ListBox أو ComboBox من حيث الإضافة والحذف والإدراج في وسطها إلخ...، وإليك مثال جربه
طبعا الـ (Class Point3d) هو يكتب مرة واحدة فقط..
كود :
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myPoints3D As New List(Of Point3d)
myPoints3D.Add(New Point3d(0, 40, 0))
myPoints3D.Add(New Point3d(0, 40, 50))
myPoints3D.Add(New Point3d(50, 40, 0))
myPoints3D.Add(New Point3d(50, 40, 50))
myPoints3D.Add(New Point3d(0, 0, 50))
myPoints3D.Add(New Point3d(50, 0, 50))
myPoints3D.Add(New Point3d(50, 0, 0))
myPoints3D.Add(New Point3d(0, 0, 0))
End Sub
#Region " Class Point3d "
Class Point3d
Private _x As Double
Private _y As Double
Private _z As Double
Sub New()
End Sub
Sub New(ByVal x As Double, ByVal y As Double, ByVal z As Double)
_x = x
_y = y
_z = z
End Sub
Public Property x() As Double
Get
Return _x
End Get
Set(ByVal value As Double)
_x = value
End Set
End Property
Public Property y() As Double
Get
Return _y
End Get
Set(ByVal value As Double)
_y = value
End Set
End Property
Public Property z() As Double
Get
Return _z
End Get
Set(ByVal value As Double)
_z = value
End Set
End Property
End Class
#End Region
End Classالسلام عليكم ورحمة الله وبركاته
