gchq
gchq

Reputation: 1759

Get the child properties from WindowsFormsHost

I have added a control to a WPF project like this

Dim HTMLEditor As New HTMLEditControl
With HTMLEditor
.Name = "EmailSend_Editor"
.EnableInlineSpelling = True
End With

Dim WinHost As New WindowsFormsHost
With WinHost
.Name = "WinHost"
.Child = HTMLEditor
End With
Grid.SetRow(WinHost, 5)
EmailSend_Grid.Children.Add(WinHost)

and it displays OK - now the problem is when I want to access the properties of the control. I have tried...

Dim WinHost As WindowsFormsHost = EmailSend_Grid.FindName("WinHost")
Dim HTMLEditor As HTMLEditControl = WinHost.Child

But it throws 'Object reference not set to an instance of an object' - I have never used WindowsFormsHost before and examples are thin on the ground. Any pointers would be appreciated.

Upvotes: 0

Views: 35

Answers (0)

Related Questions