I’m trying to use a button’s ‘click’ event to reset all the text boxes on my form. I’ve tried many iterations of the following:
Dim txt As Control For Each txt In Me.Controls If TypeOf txt Is TextBox Then txt.Text = "" Next
It doesn’t do anything. If I substitute the clearing action with MsgBox(“test”), I still don’t get anything, so I feel like for some reason the code isn’t actually looking at the collection of controls on the form, but I don’t know how to fix it. I could simply list the 27 text boxes and set them all = Nothing, but that’s bad practice.