search this site the web

Tuesday, March 16, 2010

Upper Case Letters in Text Box in vb.net

Private Sub ValidateNameTextBox(ByRef TB As TextBox)

If Not TB.Text = String.Empty Then
TB.Text = TB.Text.Substring(0, 1).ToUpper() & TB.Text.Substring(1, TB.Text.Length - 1).ToUpper()
TB.SelectionStart = TB.Text.Length
End If
End Sub


Private Sub Textbox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Textbox1.TextChanged
ValidateNameTextBox(Me.Textbox1)
End Sub

No comments:

Post a Comment