Santiago Alvarez
unread,Jun 10, 2011, 2:04:23 PM6/10/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to 1180103A - Programacion de Computadores
Private Sub Command1_Click()
Dim igual As Boolean
Dim c1, c2, mitad As Byte
Dim a1(100), a2(100), cad As String
Text2 = ""
For c1 = 1 To 100
a1(c1) = "": a2(c1) = ""
Next c1
If Text1 <> "" Then
cad = CStr(Len(Text1) / 2)
igual = True
If InStr(1, cad, ",") <> 0 Then 'Es Impar
mitad = Int(Len(Text1) / 2) + 1
c2 = 1
For c1 = mitad To 1 Step -1
cad = Mid(Text1, c1, 1)
a1(c2) = cad: c2 = c2 + 1
Next c1
c2 = 1
For c1 = mitad To Len(Text1)
cad = Mid(Text1, c1, 1)
a2(c2) = cad: c2 = c2 + 1
Next c1
For c1 = 1 To mitad
If a1(c1) <> a2(c1) Then
igual = False: Exit For
End If
Next c1
Else 'Es Par
mitad = Len(Text1) / 2
c2 = 1
For c1 = mitad To 1 Step -1
cad = Mid(Text1, c1, 1)
a1(c2) = cad: c2 = c2 + 1
Next c1
c2 = 1
For c1 = mitad + 1 To Len(Text1)
cad = Mid(Text1, c1, 1)
a2(c2) = cad: c2 = c2 + 1
Next c1
For c1 = 1 To mitad
If a1(c1) <> a2(c1) Then
igual = False: Exit For
End If
Next c1
End If
Text2 = igual: Text1.SetFocus
Else
MsgBox "Tienes que introducir un texto"
Text1.SetFocus
End If
End Sub
Private Sub Form_Load()
Text1 = "": Text2 = ""
End Sub