
01/08/2008, 11:22
|
 | | | Fecha de Ingreso: febrero-2008
Mensajes: 71
Antigüedad: 17 años, 2 meses Puntos: 0 | |
Problema: Object variable or With block variable not set Hola a todos,
Tengo Visual Basic 6 y estoy trabajanado en una aplicación que me da el error : "Object variable or With block variable not set".
Mi apliación funciona de la siguiente manera:
Cuando hago clic en un commandbutton me crea dos textbox en tiempo de ejecución. Despues con un Timer hago referencia a los textbox y me da el error :
"Object variable or With block variable not set".
Aquí el codigo:
Private Sub Command1_Click()
Dim txt1 As TextBox
Dim txt2 As TextBox
text1.text = x
Set txt1 = Form1.Controls.Add("VB.textbox", Text1.Text)
With txt1
.Visible = True
.Width = 2000
.Height = 2000
.Top = 8500
.Text = ""
.Enabled = False
End With
Set txt2 = Form1.Controls.Add("VB.textbox", Text1.Text & "comp")
With txt2
.Visible = True
.Width = 2000
.Top = 6000
.Text = ""
.Enabled = False
End With
End sub
--------------------------------( hasta aquí todo bien)------------------------------
Private Sub Timer2_Timer() 'el intervalo es de 3000
Dim txt1 As TextBox
Dim txt2 As TextBox
If Text1.Text = "" Then 'mediante esto hago que se hayan creado los textbox
goto ini
End If
If txt1.Name = Text1.Text Then 'aqui es donde me da el error
txt2.Text = "True"
Load Form2
End If
If txt2.Text = "True" Then
txt1.Text = txt1.Name & vbNewLine & Form2.Text1.Text
Else
Text1.Text = ""
End If
End sub
Espero que me puedan ayudar a solucionar este error.
Muchisimas Gracias |