leer matriz de vb6

18/10/2004 - 12:41 por Mariajose | Informe spam
Hola,
tengo una dll en VB6 la cual contiene una funcion que me devuelve variant()
function matriz() as variant()
Dim k1(2) As Variant
Dim k2(2) As Variant
Dim k() As Variant
k1(0) = "A"
k1(1) = "B"
k2(0) = "C"
k2(1) = "D"
k(0) = k1
k(1) = k2
matriz = k
end function

Quiero ver el contenido de esta matriz en asp pero me
da un error de tipos al intentar extraer sus elementos
el bucle que estoy usando para recorrer la matriz es el siguiente:
Mimatriz=obj.matriz()
For i = 0 To ubound ()
x = MiMatriz(i)
for j=0 to ubound(x)
response.write(x(j)) & "-"
next
next
¿Alguien puede decirme una forma alternativa de declarar o recorrer la
matriz ?

Muchas gracias

Preguntas similare

Leer las respuestas

#6 Mariajose
19/10/2004 - 09:45 | Informe spam
Hola, ya lo he intentado tambiñen con ubound(matriz, 1)
pero me da el siguiente error
0x800A0009)
Subscript out of range


"Jhonny Vargas P. [MVP]" escribió:

Hola,

Tienes un error en el código

Mimatriz=obj.matriz()
For i = 0 To ubound (Mimatriz, 1)
x = MiMatriz(i)
for j=0 to ubound(x)
response.write(x(j)) & "-"
next
next

Ahora te debería funcionar...



"Mariajose" escribió en el mensaje
news:
> Hola,
> tengo una dll en VB6 la cual contiene una funcion que me devuelve
variant()
> function matriz() as variant()
> Dim k1(2) As Variant
> Dim k2(2) As Variant
> Dim k() As Variant
> k1(0) = "A"
> k1(1) = "B"
> k2(0) = "C"
> k2(1) = "D"
> k(0) = k1
> k(1) = k2
> matriz = k
> end function
>
> Quiero ver el contenido de esta matriz en asp pero me
> da un error de tipos al intentar extraer sus elementos
> el bucle que estoy usando para recorrer la matriz es el siguiente:
> Mimatriz=obj.matriz()
> For i = 0 To ubound ()
> x = MiMatriz(i)
> for j=0 to ubound(x)
> response.write(x(j)) & "-"
> next
> next
> ¿Alguien puede decirme una forma alternativa de declarar o recorrer la
> matriz ?
>
> Muchas gracias



Respuesta Responder a este mensaje
#7 Sashka
19/10/2004 - 19:56 | Informe spam
-
¡Importante!: Colabora con el grupo. Contesta a este mensaje y dinos si te
sirvió o no la respuesta dada. Muchas gracias
Aca hay 2 cosas primero que nada hay un error en tu procedimiento
Matriz.
Si declaras Dim k() As Variant
No puedes pasarle valores sin redim...
Te da error en ésta línea:
k(0) = k1
y para la siguiente línea debrás usar redim preserve

Ahora... tu primer código está bien... el error está en no restarle 1 al
ubound (a ambos)... si ubound(tumatriz) = 2 entonces debes recorrer 0 y
1 al tratar de recorrer el 2 es que te da error

Mimatriz=obj.matriz()
For i = 0 To UBound(MiMatriz) - 1
x = MiMatriz(i)
For j = 0 To UBound(x) - 1
response.write(x(j)) & "-"
Next
Next

Sashka
MS MVP Access
MCP ASP.Net

"Mariajose" escribió en el mensaje
news:
Hola, ya lo he intentado tambiñen con ubound(matriz, 1)
pero me da el siguiente error
0x800A0009)
Subscript out of range


"Jhonny Vargas P. [MVP]" escribió:

Hola,

Tienes un error en el código

Mimatriz=obj.matriz()
For i = 0 To ubound (Mimatriz, 1)
x = MiMatriz(i)
for j=0 to ubound(x)
response.write(x(j)) & "-"
next
next

Ahora te debería funcionar...



"Mariajose" escribió en el mensaje
news:
> Hola,
> tengo una dll en VB6 la cual contiene una funcion que me devuelve
variant()
> function matriz() as variant()
> Dim k1(2) As Variant
> Dim k2(2) As Variant
> Dim k() As Variant
> k1(0) = "A"
> k1(1) = "B"
> k2(0) = "C"
> k2(1) = "D"
> k(0) = k1
> k(1) = k2
> matriz = k
> end function
>
> Quiero ver el contenido de esta matriz en asp pero me
> da un error de tipos al intentar extraer sus elementos
> el bucle que estoy usando para recorrer la matriz es el siguiente:
> Mimatriz=obj.matriz()
> For i = 0 To ubound ()
> x = MiMatriz(i)
> for j=0 to ubound(x)
> response.write(x(j)) & "-"
> next
> next
> ¿Alguien puede decirme una forma alternativa de declarar o recorrer la
> matriz ?
>
> Muchas gracias



email Siga el debate Respuesta Responder a este mensaje
Ads by Google
Help Hacer una pregunta AnteriorRespuesta Tengo una respuesta
Search Busqueda sugerida