25-09-12, 09:18 PM
السلام عليكم و رحمة الله و بركاته،
اليوم أقدم لكم دالة تأتي بجميع الـForms الموجودة في المشروع لكن في هيئة
بصراحة لست أنا من كتب الكود، أنا وجدته بالصدفة في أحد المواقع الأجنبية أثناء بحثي عن كود آخر ثم عدلت عليه و وضعته في دالة
الدالة:
كما كتبت صيغة أخرى للدالة لكي آتي بكل الـForms الموجودة في ملف مكتوب بالـ .Net
الدالة:
يوجد بالمرفقات مثال على أستخدام كل من الدالتين
و السلام عليكم و رحمة الله و بركاته
اليوم أقدم لكم دالة تأتي بجميع الـForms الموجودة في المشروع لكن في هيئة
PHP كود :
System.Collections.Generic.List(Of System.Windows.Forms.Form)
الدالة:
PHP كود :
Public Function GetAllForms() As System.Collections.Generic.List(Of System.Windows.Forms.Form)
Dim returnValue As New System.Collections.Generic.List(Of System.Windows.Forms.Form)
Dim formType As System.Type = GetType(System.Windows.Forms.Form)
Dim A As System.Reflection.Assembly = System.Reflection.Assembly.LoadFile(System.Windows.Forms.Application.ExecutablePath)
For Each T As System.Type In A.GetTypes()
If T.IsSubclassOf(formType) Then
returnValue.Add(CType(System.Activator.CreateInstance(T), System.Windows.Forms.Form))
End If
Next
Return returnValue
End Function
الدالة:
PHP كود :
Public Function GetAllForms(ByVal applicationPath As String) As System.Collections.Generic.List(Of System.Windows.Forms.Form)
Dim returnValue As New System.Collections.Generic.List(Of System.Windows.Forms.Form)()
Dim formType As System.Type = GetType(System.Windows.Forms.Form)
Dim A As System.Reflection.Assembly = System.Reflection.Assembly.LoadFile(applicationPath)
For Each T As System.Type In A.GetTypes()
If T.IsSubclassOf(formType) Then
returnValue.Add(CType(System.Activator.CreateInstance(T), System.Windows.Forms.Form))
End If
Next
Return returnValue
End Function
يوجد بالمرفقات مثال على أستخدام كل من الدالتين
و السلام عليكم و رحمة الله و بركاته