0% found this document useful (0 votes)
17 views2 pages

Exepriment No.8

The document contains a C# Windows Forms application code that manages user input through text boxes. It validates the input to ensure all fields are filled and the mobile number is exactly 10 digits, displaying appropriate messages based on the validation. Additionally, there is a reset functionality that clears all input fields and labels when a button is clicked.

Uploaded by

devab52664
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views2 pages

Exepriment No.8

The document contains a C# Windows Forms application code that manages user input through text boxes. It validates the input to ensure all fields are filled and the mobile number is exactly 10 digits, displaying appropriate messages based on the validation. Additionally, there is a reset functionality that clears all input fields and labels when a button is clicked.

Uploaded by

devab52664
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

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:-

You might also like