I have a MDI windows application. The user has the ability to modify control properties (eg for colors). Every MDI child form contains a sub called ApplyMyUserProfile which sets the colors.
I would like am trying to find a way to immediately run ApplyMyUserProfile on every (open) MDI child window. I can identify the open child forms, but I don't know how to tell each of those forms to run ApplyMyUserProfile() for each form.
This is what I am trying to do ::
Private Sub ModifyUserProfileParametersInOpenForms()
Dim FormName As String = ""
' loop through all open 'MDI child forms
For Each frm As Form In Application.OpenForms
If frm.IsMdiChild Then
FormName = frm.Name
Debug.Print(FormName) ' this correctly shows me the open MDI child forms
' every MDI child form has a sub called ApplyMyUserProfile() ' this sub will modify the control properties (color etc) that relate to each ' form
frm.ApplyMyUserProfile()
' this creates an error "ApplyMyUserProfile is not a member of ' Systems.Windows.Forms.form
frm.Refresh()
End If
Next frm
End Sub
' Thanks for any help!!
For Each frm As Form In Application.OpenForms
' loop through all open MDI child forms
If frm.IsMdiChild Then
If frm.Name <> "frmMyUserProfile" Then
CallByName(frm, "Form_ReloadUserProfileParameters", CallType.Method)
End If
End If
Next frm
'note 'Form_ReloadUserProfileParameters() is a public sub that must be on each of the child forms. Whatever is in this sub will be executed on the sub! (child) 'perfect!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.