Here we use two Images, one for the ChangeCase Button and one for the Clear Text Button.

The output will be:

Step 3

Now we will write the code for the Change Case Button; it is:

publicint a = 0, b = 0;

privatevoid btnCase_Click(object sender, RoutedEventArgs e)

{

if (a == 0)

{

a = 1;

b = 0;

btnq.Content = "Q";

btnw.Content = "W";

btne.Content = "E";

btnr.Content = "R";

btnt.Content = "T";

btny.Content = "Y";

btnu.Content = "U";

btni.Content = "I";

btno.Content = "O";

btnp.Content = "P";

btna.Content = "A";

btns.Content = "S";

btnd.Content = "D";

btnf.Content = "F";

btng.Content = "G";

btnh.Content = "J";

btnj.Content = "J";

btnk.Content = "K";

btnl.Content = "L";

btnz.Content = "Z";

btnx.Content = "X";

btnc.Content = "C";

btnv.Content = "V";

btnb.Content = "B";

btnn.Content = "N";

btnm.Content = "M";

}

else

{

a = 0;

btnq.Content = "q";

btnw.Content = "w";

btne.Content = "e";

btnr.Content = "r";

btnt.Content = "t";

btny.Content = "y";

btnu.Content = "u";

btni.Content = "i";

btno.Content = "o";

btnp.Content = "p";

btna.Content = "a";

btns.Content = "s";

btnd.Content = "d";

btnf.Content = "f";

btng.Content = "g";

btnh.Content = "h";

btnj.Content = "j";

btnk.Content = "k";

btnl.Content = "l";

btnz.Content = "z";

btnx.Content = "x";

btnc.Content = "c";

btnv.Content = "v";

btnb.Content = "b";

btnn.Content = "n";

btnm.Content = "m";

}

}

After writing the code when we run the program and click on the Button the Keypad will look like this:

This keypad will be useful when we want to write the UpperCase Letter.

Step 4

Now we write the code for the Digit or special characters Button; see:

privatevoid btndigit_Click(object sender, RoutedEventArgs e)

{

if (b == 0)

{

b = 1;

a = 0;

btnq.Content = "1";

btnw.Content = "2";

btne.Content = "3";

btnr.Content = "4";

btnt.Content = "5";

btny.Content = "6";

btnu.Content = "7";

btni.Content = "8";

btno.Content = "9";

btnp.Content = "0";

btna.Content = "!";

btns.Content = "#";

btnd.Content = "$";

btnf.Content = "%";

btng.Content = "^";

btnh.Content = "&";

btnj.Content = "(";

btnk.Content = ")";

btnl.Content = "-";

btnz.Content = "*";

btnx.Content = "`";

btnc.Content = ":";

btnv.Content = ";";

btnb.Content = "?";

btnn.Content = "~";

btnm.Content = "/";

}

else

{

b = 0;

btnq.Content = "q";

btnw.Content = "w";

btne.Content = "e";

btnr.Content = "r";

btnt.Content = "t";

btny.Content = "y";

btnu.Content = "u";

btni.Content = "i";

btno.Content = "o";

btnp.Content = "p";

btna.Content = "a";

btns.Content = "s";

btnd.Content = "d";

btnf.Content = "f";

btng.Content = "g";

btnh.Content = "h";

btnj.Content = "j";

btnk.Content = "k";

btnl.Content = "l";

btnz.Content = "z";

btnx.Content = "x";

btnc.Content = "c";

btnv.Content = "v";

btnb.Content = "b";

btnn.Content = "n";

btnm.Content = "m";

}

}

The output will be:

Step 5

Now we will write the code for typing the LowerCase Letter, UpperCase Letter and Digits and Special Characters in the Textbox. Here we have an example of this:

publicpartialclassVisualWebPart1 {

privatevoid btnq_Click(object sender, RoutedEventArgs e)

{

if (a == 1)

{

txtMessage.Text = txtMessage.Text + "Q";

}

if (b == 1 && a == 0)

{

txtMessage.Text = txtMessage.Text + "1";

}

if (a == 0 && b == 0)

{

txtMessage.Text = txtMessage.Text + "q";

}

}

In this example first we check the value (a=1) which we will set on the Change Case Button. After that we will check the value of (b) which can also set by us in the Digit or Special Characters Button.