How to update textbox value using global string variable as textbox name
Posted on 2008-11-01
I would normally use the following line of code to update the value of a date textbox in a form.......
SpecificForm.DateTextBox.Text = Format(MonthCalendar1.SelectionStart, "MM/dd/yyyy").ToString
BUT, in this particular sub routine I need to be able to update various maskedtextboxes as shown above using a global variable that has the name of the textbox stored in it. Using a select case I'm able to identify the form that contains the date field, but I need to be able to use the global variable in updating the textbox because there are multiple date fields on various forms....as opposed to one date field.
How can I replace "DateTextBox" with the global variable to accomplish the task?