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

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

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 :)

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.