Amjad Moustafa
أهلا وسهلا......
أنت غير مسجل لدينا كعضو في المنتدى ومع ذلك يمكنك إضافة المواضيع لإغناء النتدى

انضم إلى المنتدى ، فالأمر سريع وسهل

Amjad Moustafa
أهلا وسهلا......
أنت غير مسجل لدينا كعضو في المنتدى ومع ذلك يمكنك إضافة المواضيع لإغناء النتدى
Amjad Moustafa
هل تريد التفاعل مع هذه المساهمة؟ كل ما عليك هو إنشاء حساب جديد ببضع خطوات أو تسجيل الدخول للمتابعة.

تحديد ماإذا كان النموذج محمل بالفعل

اذهب الى الأسفل

تحديد ماإذا كان النموذج محمل بالفعل Empty تحديد ماإذا كان النموذج محمل بالفعل

مُساهمة  Amjad السبت 24 يناير 2015, 10:11 pm

'Add a module to your project (In the menu choose Project -> Add Module, Then click Open)
'Add 2 Command Buttons to your form. Add Another Form (Form 2).
'Click on the first button, and the program will detect that Form2 is not loaded.
'Now click on the second button to load Form2 and click again on the first button.
'The program will dedtect that Form2 is now loaded.
'Insert the following code to your module:

Public Function FormLoadedByName(FormName As String) As Boolean
Dim i As Integer, fnamelc As String
fnamelc = LCase$(FormName)
FormLoadedByName = False
For i = 0 To Forms.Count - 1
If LCase$(Forms(i).Name) = fnamelc Then
FormLoadedByName = True
Exit Function
End If
Next
End Function

'Insert the following code to your form (Form1):

Private Sub Command1_Click()
'Replace 'Form2' with the name of the form you want to detect his state.
If FormLoadedByName("Form2") = True Then
MsgBox "The Form is loaded"
Else
MsgBox "The Form is not loaded"
End If
End Sub

Private Sub Command2_Click()
Load Form2
End Sub

Amjad
Admin

عدد المساهمات : 71
تاريخ التسجيل : 07/11/2011

https://amjad-moustafa.rigala.net

الرجوع الى أعلى الصفحة اذهب الى الأسفل

الرجوع الى أعلى الصفحة


 
صلاحيات هذا المنتدى:
لاتستطيع الرد على المواضيع في هذا المنتدى