Foros del Web » Programación para mayores de 30 ;) » Programación General » Visual Basic clásico »

ayuda con error de tipos

Estas en el tema de ayuda con error de tipos en el foro de Visual Basic clásico en Foros del Web. A continuacion les pongo un ejercicio de guille , el tema es que funciona bien todo menos la opcion de modificacion que es el Command3 ...
  #1 (permalink)  
Antiguo 06/04/2005, 16:57
(Desactivado)
 
Fecha de Ingreso: agosto-2002
Mensajes: 1.458
Antigüedad: 21 años, 9 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
  #2 (permalink)  
Antiguo 06/04/2005, 17:30
Avatar de vbx3m  
Fecha de Ingreso: febrero-2005
Ubicación: Venezuela
Mensajes: 524
Antigüedad: 19 años, 3 meses
Puntos: 1
Escribe el valor numerico al igual que en el text6 y el text7...
__________________
ホルヘ・ラファエル・マルティネス・レオン
  #3 (permalink)  
Antiguo 06/04/2005, 18:53
(Desactivado)
 
Fecha de Ingreso: agosto-2002
Mensajes: 1.458
Antigüedad: 21 años, 9 meses
Puntos: 0
no entiendo que me quieres decir que escriba el valor numerico , cuando le doy el alta escribo el valor numerico pero cuando lo traigo para modificar me dice que no coinciden los tipos
  #4 (permalink)  
Antiguo 07/04/2005, 06:21
(Desactivado)
 
Fecha de Ingreso: agosto-2002
Mensajes: 1.458
Antigüedad: 21 años, 9 meses
Puntos: 0
por favor alguna idea ? sigo trabado con esto , gracias
  #5 (permalink)  
Antiguo 07/04/2005, 07:24
Avatar de jrp01  
Fecha de Ingreso: mayo-2004
Ubicación: México
Mensajes: 2.702
Antigüedad: 20 años
Puntos: 0
Y si pones:

ElColega = Val(Text7.Text)
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 01:07.