Can any one translate the following syntax to vb.net.
m_TextBox.Loaded += TextBoxLoaded
m_TextBox.Loaded -= TextBoxLoaded;
private void TextBoxLoaded(object sender, RoutedEventArgs e)
{
Init();
}
..
containsTextProp.AddValueChanged(m_TextBox, (sender, args) => UpdateAdorner());
...
private void UpdateAdorner()
{...}
Here it is:
Your call to
AddValueChangedcan’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 aFunction. In your case, you would be calling aSub, which isn’t allowed in VB.NET. You should consider changing the signature ofUpdateAdornerto be a standard event handler (like theTextBoxLoadedmethod) and passAddressOf UpdateAdoernertoAddValueChanged.Like this: