Ejemplo de matriz tipo string
Dim x As Integer Dim y As Integer Dim n As String Dim n1 As String Dim n2 As String Dim mat(4, 2) As String Dim dato As String Dim nombre As String Dim error As String Dim respuesta As Boolean Private Sub buscar_Click() nombre = Text2.Text error = "No Existe ese dato en este registro" For x = 0 To 4 For y = 0 To 2 If (mat(x, y) = nombre) Then n = mat(x, y) n1 = mat(x, y + 1) n2 = mat(x, y + 2) respuesta = True End If Next y Next x If (respuesta = True) Then Text1.Text = n Text3.Text = n1 Text4.Text = n2 respuesta = False Else Text1.Text = error Text3.Text = error Text4.Text = error respuesta = False End If End Sub Private Sub limpiar_Click() For x = 0 To 4 For y = 0 To 2 mat(x, y) = 0
Next y Next x List1.Clear List2.Clear List3.Clear Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text1.SetFocus End Sub Private Sub operar_Click() For x = 0 To 4 For y = 0 To 2 If (y = 0) Then dato = InputBox("Ingrese el nombre: ", "Datos") mat(x, y) = dato Else If (y = 1) Then dato = InputBox("Ingrese primer nota", "Nota") mat(x, y) = dato Else If (y = 2) Then dato = InputBox("Ingrese segunda nota", "Nota") mat(x, y) = dato End If End If End If Next y Next x y=0 For x = 0 To 4 List1.AddItem mat(x, y) Next x y=1 For x = 0 To 4 List2.AddItem mat(x, y) Next x y=2 For x = 0 To 4 List3.AddItem mat(x, y) Next x End Sub Private Sub salir_Click()
End End Sub