0

I have a task, my textbox accepts only first character capital lettr and remaing characters normal.

user1858718
  • 137
  • 2
  • 3
  • 12

1 Answers1

1

Use KeyPress event of textbox:


    private void txt_KeyPress(object sender, KeyPressEventArgs e)
    {
        if (txt.Text != "" && !Char.IsUpper(txt.Text, 0))
        {
            txt.Text = Char.ToUpper(txt.Text[0]) + txt.Text.Substring(1);
        }
    }

suco2007
  • 131
  • 1
  • 7
  • thanks for reply but its working reverse what is my requirement,my requirerment is first character should be capital letter – user1858718 Dec 04 '12 at 05:33