Write an algorithm that creates a windows application that contains two TextBox objects and two Button objects. One of the TextBox objects and one of the buttons are initially invisible. The first textbox should be used to input a password. The textbox should be masked to some character of your choice so that the characters entered by the user are not seen on the screen. When the user clicks the first button, the second TextBox object and button object should be displayed with a prompt asking the user to reenter his or her password. Now the user clicks the second button, have the application compare the values entered to make sure they are the same. Display an appropriate message indicating whether they are the same.
namespace Add_and_Multiply
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int val1;
int val2;
val1 = Convert.ToInt32(textBox1.Text);
val2 = Convert.ToInt32(textBox2.Text);
label3.Text = Convert.ToString(val1 + val2); //after this line I tried putting the code to give me yellow color text and now I have so many errors:(
}
private void button2_Click(object sender, EventArgs e)
{
int val1;
int val2;
val1 = Convert.ToInt32(textBox1.Text);
val2 = Convert.ToInt32(textBox2.Text);
label3.Text = Convert.ToString(val1 * val2);
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
Comments
Leave a comment