Exepriment No.
:-08
Input:-
using System;
using System.Drawing;
using System.Windows.Forms;
namespace WindowsFormsApp3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrEmpty(textBox2.Text) ||
string.IsNullOrEmpty(textBox3.Text) || string.IsNullOrEmpty(textBox4.Text) ||
textBox2.Text.Length != 10)
{
label5.ForeColor = Color.Red;
label5.Text = "Enter proper details";
}
else
{
label5.ForeColor = Color.Green;
label5.Text = "All fields are filled!";
label6.Text = "Your Name: "+ textBox1.Text + "\n" + "Your Mobile no: " +
textBox2.Text + "\n" + "Your email: " + textBox3.Text + "\n" + "Your address: " + textBox4.Text
+ "\n";
}
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
label5.Text = "";
label6.Text = "Your Details:";
}
}
}
Output:-