Despite the 25% acceptance rate, here it is:
AddHandler m_TextBox.Loaded, AddressOf TextBoxLoaded
RemoveHandler m_TextBox.Loaded, AddressOf TextBoxLoaded
Private Sub TextBoxLoaded(ByVal sender as Object, ByVal e as RoutedEventArgs)
Init()
End Sub
Your call to AddValueChanged
can't be directly translated, as VB.NET's lambda expression support is not as robust as C#'s. In particular, VB.NET lambdas must be an expression, so you must either return a value or call a Function
. In your case, you would be calling a Sub
, which isn't allowed in VB.NET. You should consider changing the signature of UpdateAdorner
to be a standard event handler (like the TextBoxLoaded
method) and pass AddressOf UpdateAdoerner
to AddValueChanged
.
Like this:
containsTextProp.AddValueChanged(m_TextBox, AddressOf UpdateAdorner);
...
Private Sub UpdateAdorner(ByVal sender as Object, ByVal e as EventArgs)
...
End Sub