Está en la página 1de 3

'generar el archivo estudiante.

dat : que tendra como dato compuesto:


codigo SIS, Ap. Paterno ,Ap materno, nombre , carrera, telefono
Dim A(1 To 10) As String
Private Sub Command1_Click()
For i = 1 To 10 Step 1
A(i) = InputBox("codigo sis ,apellido paterno, apellido materno, nombre,
carrera, telefono ")
List1.AddItem (A(i))
Next i
End Sub

Private Sub Command2_Click()


Open "D:\estudiante.dat" For Output As #1
For i = 1 To 10 Step 1
Print #1, A(i)
Next i
Close #1
End Sub

Private Sub Command3_Click()


Open "D:\ estudiante.dat" For Input As #2
For i = 1 To 10 Step 1
Input #2, A(i)
List1.AddItem A(i)
Next i
Close #2
End Sub
Dim A(1 To 10) As String
Dim i As Integer
Dim nr As Integer
Private Sub Command1_Click()
Open "D:\estudiante.dat" For Input As #2
i=1

While Not EOF(2)


Input #2, A(i)
List1.AddItem A(i)
i=i+1
Wend
nr = i - 1 ' la cantidad de registros del archivo
Close #2
End Sub

Private Sub Command2_Click()


Dim p, cc, am, nom, carr, fono, cod, aux, ap As String
Open "D:\codigo.dat" For Output As #3
For i = 1 To nr Step 1
p = InStr(A(i), " ")
cod = Left(A(i), p - 1)
aux = Mid(A(i), p + 1, Len(A(i)) - p)
List2.AddItem cod
p = InStr(aux, " ")
ap = Left(aux, p - 1)
List3.AddItem ap
aux = Mid(aux, p + 1, Len(aux) - p)
p = InStr(aux, " ")
am = Left(aux, p - 1)
aux = Mid(aux, p + 1, Len(aux) - p)
p = InStr(aux, " ")
nom = Left(aux, p - 1)
aux = Mid(aux, p + 1, Len(aux) - p)
p = InStr(aux, " ")

carr = Left(aux, p - 1)
fono = Right(aux, Len(aux) - p)

'inciso b
If LCase(Left(nom, 1)) = "a" Then
List4.AddItem cod
End If
'inciso c
If LCase(busca) = LCase(carr) Then
List5.AddItem A(i)
End If
'inciso f
cc = cod & UCase(Left(ap, 1)) & UCase(Left(am, 1)) & UCase(Left(nom, 1))
List6.AddItem cc
'inciso g
Print #3, cc
Next i
Close #3
End Sub