In a simple program that I am working on in VB.NET, I have created several ComboBoxes and TextBoxes dynamically.
For example, like:
Dim i As Integer
For i = 0 To 11
Dim NewTxt As New TextBox()
Me.Controls.Add(NewTxt)
NewTxt.Name = "txtNoteInput" & i
Next
I would like to restrict the user from entering certain keyboard characters into these TextBoxes. I have done this in the past for individual TextBoxes created visually by using “… Handles ExampleTextBox.KeyPress” (Something like described here: http://msdn.microsoft.com/en-us/library/ms171538.aspx ).
I am looking for help on how to do this: (1) for dynamically created TextBoxes, and (2) with one (or few) blocks of code which apply to many TextBoxes.
Using this as a reference, something along the lines of:
With: