Private Sub ClearTextBoxes(ByVal depObject As DependencyObject) For i As Integer = 0 To VisualTreeHelper.GetChildrenCount(depObject) - 1 If TypeOf depObject Is TextBox Then CType(depObject, TextBox).Text = Nothing End If ClearTextBoxes(VisualTreeHelper.GetChild(depObject, i)) Next
Error 4 Expression of type 'System.Windows.DependencyObject' can never be of type 'System.Windows.Forms.TextBox'.
It seems like you use the wrong namespace for the TextBox class.
TextBox
Try System.Windows.Controls.TextBox instead.
System.Windows.Controls.TextBox
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)