
06/04/2005, 16:57
|
(Desactivado) | | Fecha de Ingreso: agosto-2002
Mensajes: 1.458
Antigüedad: 22 años, 8 meses Puntos: 0 | |
ayuda con error de tipos A continuacion les pongo un ejercicio de guille , el tema es que funciona bien todo menos la opcion de modificacion que es el Command3 , me da error de tipos en .Edad = Text5.Text y no entiendo por que da ese error ?
Option Explicit
Private Type tColega
Nombre As String
Apellidos As String
Direccion As String
Poblacion As String
Edad As Integer
Vecesquelemandounemailynocontesta As Long
End Type
Const MaxColegas = 50
Dim MisColegas(1 To MaxColegas) As tColega
Dim Colega As Integer
Private Sub Command1_Click()
If Colega < MaxColegas Then
Colega = Colega + 1
With MisColegas(Colega)
.Nombre = Text1.Text
.Apellidos = Text2.Text
.Direccion = Text3.Text
.Poblacion = Text4.Text
.Edad = Text5.Text
.Vecesquelemandounemailynocontesta = Text6.Text
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
End With
Caption = "Mis Colegas (" & Colega & " )"
Else
MsgBox "Atencion ya Tienes bastantes colegas"
End If
End Sub
Private Sub Command2_Click()
Dim i As Integer
Dim sTmp As String
For i = 1 To Colega
With MisColegas(i)
sTmp = .Nombre & vbCrLf & _
.Apellidos & vbCrLf & _
.Direccion & vbCrLf & _
.Poblacion & vbCrLf & _
.Edad & vbCrLf & _
.Vecesquelemandounemailynocontesta
End With
MsgBox "Datos del colega " & CStr(i) & vbCrLf & sTmp
Next
End Sub
Private Sub Command3_Click()
Dim ElColega As Integer
ElColega = Text7.Text
If ElColega > Colega Or ElColega < 1 Then
MsgBox "El numero deber ser entre 1 y " & Colega
Else
With MisColegas(ElColega)
.Nombre = Text1.Text
.Apellidos = Text2.Text
.Direccion = Text3.Text
.Poblacion = Text4.Text
.Edad = Text5.Text
.Vecesquelemandounemailynocontesta = Text6.Text
End With
End If
End Sub
Private Sub Form_Load()
Colega = 0
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Caption = "Mis Colegas"
End Sub
Gracias |