Ver Mensaje Individual
  #10 (permalink)  
Antiguo 19/03/2008, 09:40
Avatar de Laforge
Laforge
 
Fecha de Ingreso: noviembre-2004
Ubicación: Galaxia 34, Cuadrante 972, Área 31
Mensajes: 174
Antigüedad: 19 años, 6 meses
Puntos: 2
Re: Cadena de String ¡¡¡

... hombre Avellaneda, mi respuesta no tenía ánimo de ofensa, pero de todas formas, algo así serviría....

Código:
Option Explicit
Private PonEdad As Byte, PonTel As Byte
Private Sub Form_Load()
PonEdad = 0
PonTel = 0
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
Dim Posicion
If PonEdad = 0 Then
    Posicion = InStr(1, Text1.Text, "edad:", vbTextCompare)
    If Posicion <> 0 And Text2 = "" Then
        PonEdad = 1
    End If
ElseIf PonEdad = 1 Then
    If KeyCode = 32 And Text2.Text = "" Then Exit Sub
    If KeyCode = 32 And Text2.Text <> "" Then PonEdad = 2
    Text2.Text = Text2.Text & Chr(KeyCode)
End If
If PonTel = 0 Then
    Posicion = InStr(1, Text1.Text, "tel:", vbTextCompare)
    If Posicion <> 0 And Text3 = "" Then
        PonTel = 1
    End If
ElseIf PonTel = 1 Then
    If KeyCode = 32 And Text3.Text = "" Then Exit Sub
    If KeyCode = 32 And Text3.Text <> "" Then PonTel = 2
    Text3.Text = Text3.Text & Chr(KeyCode)
End If
End Sub
Donde Text1 es el texto donde se inserta el escrito, text2 es donde va a parar la edad y text3 es donde va a parar un posible número de teléfono.

Cabe tener en cuenta que como utilizo el chr(keycode) tiene algunas limitaciones (como a la hora de utilizar el numpad o lo signos (punto, coma,...) pero funcionar funciona.....
__________________
Nunca esperes un mejor momento para abrir esa botella de vino...........nunca llega.

No hay vida después de MySQL