【問題があったプログラム】 For i As Integer = 0 To Me.DataRepeater1.ItemTemplate.Controls.Count - 1 Select Case Me.DataRepeater1.ItemTemplate.Controls(i).GetType.Name Case "MaskedTextBox" Dim msk As MaskedTextBox = DirectCast(Me.DataRepeater1.ItemTemplate.Controls(i), MaskedTextBox) Select Case msk.Name Case Else AddHandler msk.KeyDown, AddressOf DRMaskedTextBox_KeyDown AddHandler msk.Enter, AddressOf DRMaskedTextBox_GotFocus AddHandler msk.Validated, AddressOf EditTextBoxControl_Validated End Select End Select Next