0

Hi,

I want to make my staff id text box only accept upper case letters and not lower cases, please how do i go about it?

I wrote these lines but they stil dont work:

Private Sub txtStudID_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtStudID.KeyPress

        txtStudID.Text.ToUpper()

    End Sub

Thanks for your help in advance

2
Contributors
2
Replies
4
Views
5 Years
Discussion Span
Last Post by tomexlfc
0

try this

Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
        e.KeyChar = UCase(e.KeyChar)
    End Sub
0

try this

Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
        e.KeyChar = UCase(e.KeyChar)
    End Sub

Hi King,
Thanks for the post, it works fine now..

God bless :)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.