Retroceder   Foros del Web > Temas generales de computación > Programación > Visual Basic

Respuesta
 
Herramientas Desplegado
Antiguo 06-abr-2005, 16:57   #1 (permalink)
hugorei está en el buen camino
 
Fecha de Ingreso: noviembre-2002
Ubicación: Buenos Aires
Mensajes: 1.476
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
hugorei está desconectado   Responder Citando
Antiguo 06-abr-2005, 17:30   #2 (permalink)
vbx3m está en el buen camino
 
Avatar de vbx3m
 
Fecha de Ingreso: febrero-2005
Ubicación: Venezuela
Mensajes: 524
Enviar un mensaje por MSN a vbx3m Enviar un mensaje por Yahoo  a vbx3m
Cool

Escribe el valor numerico al igual que en el text6 y el text7...
__________________
ホルヘ・ラファエル・マルティネス・レオン
vbx3m está desconectado   Responder Citando
Antiguo 06-abr-2005, 18:53   #3 (permalink)
hugorei está en el buen camino
 
Fecha de Ingreso: noviembre-2002
Ubicación: Buenos Aires
Mensajes: 1.476
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
hugorei está desconectado   Responder Citando
Antiguo 07-abr-2005, 06:21   #4 (permalink)
hugorei está en el buen camino
 
Fecha de Ingreso: noviembre-2002
Ubicación: Buenos Aires
Mensajes: 1.476
por favor alguna idea ? sigo trabado con esto , gracias
hugorei está desconectado   Responder Citando
Antiguo 07-abr-2005, 07:24   #5 (permalink)
jrp01 está en el buen camino
 
Avatar de jrp01
 
Fecha de Ingreso: mayo-2004
Ubicación: México
Mensajes: 2.704
Enviar un mensaje por MSN a jrp01
Y si pones:

ElColega = Val(Text7.Text)
jrp01 está desconectado   Responder Citando
Respuesta

No hay votos aún.


Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

BB code is Activado
Caritas están Activado
[IMG] está Activado
Código HTML está Desactivado


La Zona horaria es GMT -6. Ahora son las 04:30.


Message Board Statistics

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93