Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
445
Update open child form textbox from parent form with tgabbed MDI mgr
posted
I have a small app that uses a tabbed mdi mgr and a menu bar to load some child forms. On the parent, I have a date selector. When I change the date, I want to update an open child form (in tabbed MDI) with the new date and perform some actions, such as change text in a textbox.
What would be the best way to automatically update all open child forms when the date is changed on the parent at anytime?  I have tried code below but doesn't really work.
I change the date in date selector event like (
Form1.dateProcessed = Me.cmdChangeDate.Text
In tabbed child I use and set up an event/property like

Private fField As String
Public Event UpdateDate(ByVal x As String)
Public Property dateProcessed() As String
Get
 Return Me.fField
End Get
Set(ByVal value As String)
' Raise the event
  RaiseEvent UpdateDate(value)
  UpdateFormText(value)
End Set
End Property

this calls my delegate sub:

Delegate Sub MethodInvoker(ByVal arg As Object)
Private Sub UpdateFormText(ByVal arg As Object)
If Me.InvokeRequired Then
  Me.Invoke(New MethodInvoker(AddressOf UpdateFormText), arg)
   Exit Sub
Else
  Me.UltraTextEditor1.Text = arg.ToString
End If
End Sub

 

 

This does call the delegate and at the point where the UltratextEditor1.text is assigned it does have the value correctly but does not actually display on child form. This works OK if I do not use a tabbed mdi mgr, but regular MDI without tabs. I cannot figure out what I'm doing wrong. Any suggestions?