codice:Private WithEvents txtobjev As TextBox Private Sub Form_Load() Dim txtobj As TextBox Call Aggiungi_Textbox("txtRunTime", Me) Set txtobj = Oggetto("txtRunTime", Me) txtobj.Left = 100 txtobj.Visible = True Set txtobjev = txtobj End Sub Private Sub txtobjev_KeyPress(KeyAscii As Integer) Select Case txtobjev.Name Case "txtRunTime" Label1.Caption = "KeyPress (txtRunTime) " & Chr(KeyAscii) End Select End Sub Public Sub Aggiungi_Textbox(sNome As String, NomeForm As Form) Dim txtControl1 As TextBox Set txtControl1 = NomeForm.Controls.Add("VB.TextBox", sNome) End Sub Public Function Oggetto(sNome As String, NomeForm As Form) As Control Dim obj As Control For Each obj In NomeForm.Controls If obj.Name = sNome Then Set Oggetto = obj Exit For End If Next End Function