Ver Mensaje Individual
  #3 (permalink)  
Antiguo 16/08/2006, 20:07
Avatar de black_devil
black_devil
 
Fecha de Ingreso: junio-2006
Mensajes: 89
Antigüedad: 17 años, 10 meses
Puntos: 1
a ver si te sirve

Para aceptar sólo números

Código:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii <> 8 Then
If Not IsNumeric("0" & this & Chr(KeyAscii)) Then
Beep
KeyAscii = 0
End If
End If
End Sub
Para convertir tu texto con decimal:

Código:
Private Sub Text1_Validate(Cancel As Boolean)
Text1.text = Format(Text1.text,"#,##0.0")
End Sub
En formato moneda:

Código:
Text1.text = Format(Text1.text,"$#,##0.0")
Después del 0. agregas los decimales que quieres mostrar, por ej. $1000,0
la idea es que cuando presiones enter, se transforme tu resultado ...

Ojo, para que trabajes con enter coloca esto en el evento del FORM

Código:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then SendKeys "{tab}"
End Sub
y en la propiedad KeyPreview del FORM déjalo en True para que trabajes con enter...


Saludos