0% found this document useful (0 votes)
45 views4 pages

Practicals (7 To 8)

The document describes two Windows Forms applications. The first application checks if a number entered by the user is a palindrome and displays the result in a label. The second application allows the user to input their name and a message, formats the label text based on user selections, and includes buttons for displaying the message, clearing inputs, and exiting the application.

Uploaded by

Nitin Sharma
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)
45 views4 pages

Practicals (7 To 8)

The document describes two Windows Forms applications. The first application checks if a number entered by the user is a palindrome and displays the result in a label. The second application allows the user to input their name and a message, formats the label text based on user selections, and includes buttons for displaying the message, clearing inputs, and exiting the application.

Uploaded by

Nitin Sharma
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/ 4

7.

Create an application that allows the user to enter a number in the textbox named
,,getnum". Check whether the number in the textbox ,,getnum" is palindrome or not. Print the
message accordingly in the label control named lbldisplay when the user clicks on the button ,,check".

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApplication4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)


{
int n = int.Parse(getnum.Text);
int f=0;
int n1 = n;
while (n1>0)
{
int r = n1 % 10;
f = f * 10 + r;
n1 = n1 / 10;
}
if (f == n)
{
lbldisplay.Text = "palindrom";
}
else
{
lbldisplay.Text = "not palindrom";
}
}
}
}

8. Create an application which will ask the user to input his name and a message, display the two items
concatenated in a label, and change the format of the label using radio buttons and check boxes for
selection , the user can make the label text bold ,underlined or italic and change its color . include
buttons to disp y the message in the label, clear the text boxes and label and exit.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace practical8_NameAndMessage_
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void btnDisplay_Click(object sender, EventArgs e)


{
label3.Text = txtName.Text + " " + txtMessage.Text;
}

private void rdoRed_CheckedChanged(object sender, EventArgs e)


{
if(rdoRed.Checked==true)

label3.ForeColor = Color.Red;

private void rdoGreen_CheckedChanged(object sender, EventArgs e)


{
if(rdoGreen.Checked==true)

label3.ForeColor = Color.Green;

private void rdoBlue_CheckedChanged(object sender, EventArgs e)


{
if(rdoBlue.Checked == true )
label3.ForeColor = Color.Blue;
}

private void chkBold_CheckedChanged(object sender, EventArgs e)


{
if(chkBold.Checked ==true )
label3.Font = new Font(label3.Font, FontStyle.Bold);
}

private void Form1_Load(object sender, EventArgs e)


{

private void chkItalic_CheckedChanged(object sender, EventArgs e)


{
if (chkItalic.Checked == true)
{
label3.Font = new Font(label3.Font, FontStyle.Italic);
}
}

private void chkUnderline_CheckedChanged(object sender, EventArgs e)


{
if(chkUnderline.Checked ==true)
label3.Font = new Font(label3.Font, FontStyle.Underline);

private void btnClear_Click(object sender, EventArgs e)


{
txtMessage.Clear();
txtName.Clear();
label3.Text = "";
}

private void btnExit_Click(object sender, EventArgs e)


{
Application.Exit();

}
}
}

You might also like