0

Currently working through a Teach Yourself WPF tutorial. Usually I can mentally convert from C# to VB without any problem but this C# syntax is unfamiliar. How is it written in VB?

Private void Button_Click(object sender, RoutedEventArgs e)
{
    ((Person)DataContext).FirstName = "blah blah"
}

My usual fave online converters are choking on this ... perhaps because they don't do WPF?

1 Answer 1

1

try this

Private Sub Button_Click(ByVal sender As System.Object, ByVal e as RoutedEventArgs) Handles Button.Click
 DirectCast(DataContext, Person).FirstName = "blah blah"
End Sub
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.