Error 344 Indice para la matriz de objetos
Publicado por Emanuel (2 intervenciones) el 29/10/2020 20:04:03
ESPAÑOL:
Estoy intentando traducir un programa cargando texto desde la base de datos.
Tengo controles que son arrays y otros que no.
El método funciona bien en los controles que no son arrays.
En los controles que sí son arrays me da un ERROR 344. No reconoce el indice para el control. Alguna solución?
ENGLISH:
I am trying to translate a program by loading text from the database.
I have controls that are arrays and others that are not.
The method works fine on controls that are not arrays.
In the controls that are arrays I get an ERROR 344. It does not recognize the index for the control. Any solution?


Estoy intentando traducir un programa cargando texto desde la base de datos.
Tengo controles que son arrays y otros que no.
El método funciona bien en los controles que no son arrays.
En los controles que sí son arrays me da un ERROR 344. No reconoce el indice para el control. Alguna solución?
ENGLISH:
I am trying to translate a program by loading text from the database.
I have controls that are arrays and others that are not.
The method works fine on controls that are not arrays.
In the controls that are arrays I get an ERROR 344. It does not recognize the index for the control. Any solution?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
If Rs.RecordCount > 0 Then
Rs.MoveFirst
'Recorre el recordset para asignar el caption de los controles y objetos
While Not Rs.EOF
For Each ElControl In Controls
'si está dentro lo deshabilita
If ElControl.Name = Rs!nombre Then
' Agregar mas controles si es necesario
If (TypeOf ElControl Is Label) Or _
(TypeOf ElControl Is Frame) Or _
(TypeOf ElControl Is CheckBox) Or _
(TypeOf ElControl Is OptionButton) Or _
(TypeOf ElControl Is Menu) Or _
(TypeOf ElControl Is CommandButton) Then
'Asigna el caption
If Rs!indice <> "" Then
ElControl(Rs!indice).Caption = Rs!texto
Else
ElControl.Caption = Rs!texto
End If
ElseIf (TypeOf ElControl Is TextBox) Then
'si es un textbox, RichTexbox etc...
If Rs!indice <> "" Then
ElControl(Rs!indice).Text = Rs!texto
Else
ElControl.Text = Rs!texto
End If
Else
'Error
MsgBox "Error: " & Err.Description, vbCritical
End If
End If
Next
'Siguiente registro
Rs.MoveNext
Wend
End If
On Local Error Resume Next
Rs.Close


Valora esta pregunta


0