Foro de elhacker.net

Programación => Programación Visual Basic => Mensaje iniciado por: Adri58 en 23 Diciembre 2006, 14:01 pm



Título: Duda Muy Chorra Con Un Array
Publicado por: Adri58 en 23 Diciembre 2006, 14:01 pm
Como se inicializa un array de strings una vez declarado?
Lo normal es hacer esto:
Código:
Private Sub Command1_Click()
     Dim matriz() As String
     ReDim matriz(0 to 2)
     matriz(0)="jhgjh"
     matriz(1)="jadfjhdf"
     matriz(2)="jhgjhgjhJ"
End Sub
Pero se puede hacer algo asi?
Código:
Private Sub Command1_Click()
        Dim matriz() As String
        ReDim matriz(0 To 2)
        matriz() = "adhffvsdhfs","gdfgdfg","xfxgdfg"
End Sub
O Sea, Asignar los datos del array pero todos de golpe?
PD: Ya se que es chorra la pregunta  :-( :-(


Título: Re: Duda Muy Chorra Con Un Array
Publicado por: CeLaYa en 23 Diciembre 2006, 14:21 pm
creo que lo podrías hacer así:

Código:
dim Matriz as Variant
Matriz = Array("adhffvsdhfs","gdfgdfg","xfxgdfg")


Título: Re: Duda Muy Chorra Con Un Array
Publicado por: Adri58 en 23 Diciembre 2006, 16:27 pm
Ok, muchas gracias. Funciona perféctamente