I have an assignment to create a program that basically grades a multiple choice test. I have a form with 20 textboxes to accept input (only the letters "a", "b", "c", or "d"), an array with the correct answers, and I created an array to hold all the text boxes:
dim txtboxes() as TextBox = {txtInput1, txtInput2...txtInput20}
I know there's got to be a way to use For Each where the type of control = textbox to iterate over all the textboxes, but I am kind of stuck on actually extracting the values from the textboxes and adding them to an array of their own. I've gotten as far as:
dim txtbox as TextBox
for each txtbox in Controls.OfType(Of TextBox)
which isn't very far at all...
TextBoxcontrols, so in theory you don't have to check if they are of type TextBox. You could simply loop through the array.For Each text In txtboxes.Select(Function(textbox) textbox.Text) ...