This application consists of a textbox and a label. As the user types in the text box the label displays the number of characters that have been entered. The code is as follows :
private void textBox1_TextChanged (object sender, EventArgs e)
{
int charactercount;
string labeloutput;
charactercount = textBox1.TextLength;
labeloutput = charactercount.ToString();
lblcount.Text = "Character count : " + labeloutput;
{
Showing posts with label textbox. Show all posts
Showing posts with label textbox. Show all posts
Sunday, 27 September 2009
Collect user input from form and change it to upper or lower case in C#
In this example I have a text box on my windows form to collect the user input and a label to display the outcome once a button is pressed. The code is as follows to change the input to upper and lower case.
private void button3_Click(object sender, EventArgs e)
{
label1.Text = textBox.Text.ToUpper();
}
or
{
label1.Text = textBox.Text.ToLower();
}
private void button3_Click(object sender, EventArgs e)
{
label1.Text = textBox.Text.ToUpper();
}
or
{
label1.Text = textBox.Text.ToLower();
}
Subscribe to:
Posts (Atom)