Guys, I want my textbox are ALL CAPITAL letters even I encode a small letter and it will become Capital .. thanks guys!

Recommended Answers

All 6 Replies

Here's your code:

    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
        TextBox1.Text = TextBox1.Text.ToUpper()
    End Sub
commented: Correct! +8

Hi,

Here are other ways of doing it with Keychar or CharacterCasing:

  Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    TextBox2.CharacterCasing = CharacterCasing.Upper 'already by formload can you set te Char in a Textbox toUpper
End Sub

Private Sub TextBox1_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
        If Char.IsLower(e.KeyChar) Then

            e.Handled = True

            SendKeys.Send(Char.ToUpper(e.KeyChar))

        End If
    End Sub

Hope it helps,

commented: Correct! +8

Thanks Eternel
Thanks Luc

both of your codes are right thanks again :)

Hi nashy,

Glad to help.
You could mark your thread as "Solved" with the link below the last post.

Thanks again to you guys:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.