Enlaces patrocinados:

Trucos de Visual Basic 6.0 Convertir un texto a mayúsculas o minúsculas

Crear un formulario y situar un TextBox. Escribir:

Private Sub Text1_Change()
Dim I As Integer
Text1.Text = UCase(Text1.Text)
I = Len(Text1.Text)
Text1.SelStart = I
End Sub

Comentarios sobre Convertir un texto a mayúsculas o minúsculas


Jorge dice:

No hace falta tanto codigo, con poner: Private Sub Text1_Change() Text1.Text = UCase(Text1.Text) End Sub es suficiente
Comentario publicado 17/03/2010 6:16:00

José Romo dice:

Que tal! es una buena forma de cambiar a mayusculas conforme vamos escribiendo... PERO... lo que nos dice jorge: Text1.Text = UCase(Text1.Text) no funciona, puesto que pondra en orden inverso las letras... es decir, la primer letra que pongamos, quedara al final del textbox y con el primer código (el largo) no acepta los espacios, pone todo junto, sabran alguna forma de evitar esto?... gracias
Comentario publicado 18/03/2010 20:36:00

Ariel dice:

En el evento KeyPress If KeyAscii = 13 Then TextModelo.SetFocus Else KeyAscii = Asc(UCase(Chr(KeyAscii))) End If
Comentario publicado 28/04/2010 3:16:00

pablo dice:

Private Sub Text1_Change() Dim I As Integer Text1.Text = UCase(Text1.Text) I = Len(Text1.Text) Text1.SelStart = I End Sub El único punto a cambiar de este código (si usamos vb.net 2008) en vez de Text1.SelStart = I Colocamos Text1.SelectionStart = I y Listo
Comentario publicado 16/03/2011 4:54:00

vivier dice:

si le genera error al espacio coloquen. Private Sub Text1_KeyPress(KeyAscii As Integer) If (KeyAscii >= Asc("a") And KeyAscii <= Asc("z")) Or (KeyAscii >= Asc("A") And KeyAscii <= Asc("Z")) Or KeyAscii = 13 Or KeyAscii = 32 Or KeyAscii = 8 Then KeyAscii = Asc(UCase(Chr(KeyAscii))) If KeyAscii = 13 Then el resto ya lo sabemos
Comentario publicado 11/04/2011 19:44:00

temoc dice:

para que se complican la vida ejeje private void txtClave_KeyPress(object sender, KeyPressEventArgs e) { if (Char.IsLetter(e.KeyChar)) { e.Handled = false; e.KeyChar = e.KeyChar.ToString().ToUpper()[0]; } else if (Char.IsControl(e.KeyChar)) { e.Handled = false; } else if (Char.IsSeparator(e.KeyChar)) { e.Handled = false; } else { e.Handled = true; } //e.KeyChar = e.KeyChar.ToString().ToUpper()[0]; }
Comentario publicado 04/05/2011 0:59:00

temoc dice:

en el evento KeyPress del la caja de texto solo pongan e.KeyChar = e.KeyChar.ToString().ToUpper()[0]; y listo cuando pulces una tecla se cambiara a mayusculas
Comentario publicado 04/05/2011 1:01:00

faby dice:

como hago para q m acept solo la primra letra en mayuscula y el resto no
Comentario publicado 01/10/2011 19:59:00

Emmanuel dice:

Solo tienen que poner txtnombre.text = txtnombre.tex.toupper
Comentario publicado 24/10/2011 13:54:00

Choli dice:

Como podria ser para un combobox
Comentario publicado 04/12/2011 20:53:00

amd dice:

si funciona :-)
Comentario publicado 15/12/2011 1:31:00
Dejar un comentario

Nombre:

Mail:

Web:

Comentario:

Código de seguridad

Captcha

Inserta el código de seguridad