SlideShare a Scribd company logo
21SOEIT11003 Enterprise Computing Through .NET Framework (CE525)
Dhvani Bhesaniya 5ITA
Dhvani Bhesaniya
20SOEIT11003
LAB_TUTORIAL06
5ITA
21SOEIT11003 Enterprise Computing Through .NET Framework (CE525)
Dhvani Bhesaniya 5ITA
1 : Design an application like follow. Dependson user selection it will
display the message as
shown. (If gender is Male then Mr. or Female then Miss)
code:
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 LabTut06
{
public partial class Form1 : Form
{
string a, b,c,d,h,i,j,k,l;
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
a = textBox1.Text.ToString();
if (radioButton1.Checked)
{
c = "Mr. ";
}
else if (radioButton2.Checked)
{
c = "Miss ";
}
else
{
MessageBox.Show("please select any Gender ");
}
if (checkBox1.Checked)
{
h = " Newspaper ";
}
if (checkBox2.Checked)
21SOEIT11003 Enterprise Computing Through .NET Framework (CE525)
Dhvani Bhesaniya 5ITA
{
i = " Website ";
}
if (checkBox3.Checked)
{
j = " Friends ";
}
if (checkBox4.Checked)
{
b = textBox2.Text.ToString();
}
else
{
MessageBox.Show("please select any source ");
}
label4.Text = ("Hello "+c+a+" You know about us from "+h+i+j+","+b);
}
}
}
Output:
2 : Designa formlike below.ImplementFollowingfunctionalitytothe application.
21SOEIT11003 Enterprise Computing Through .NET Framework (CE525)
Dhvani Bhesaniya 5ITA
the listbox withitems.
itemfromListBox
Code:
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 LabTut06
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
label4.Text = listBox1.SelectedItem.ToString();
}
private void button1_Click(object sender, EventArgs e)
{
listBox1.Items.Add("Food For All");
listBox1.Items.Add("Good Books");
listBox1.Items.Add("Freedom of speech");
listBox1.Items.Add("Education ");
listBox1.Items.Add("XYZ");
listBox1.Items.Add("Good Movies");
listBox1.Sorted = false;
}
private void button5_Click(object sender, EventArgs e)
{
21SOEIT11003 Enterprise Computing Through .NET Framework (CE525)
Dhvani Bhesaniya 5ITA
label2.Text = listBox1.Items.Count.ToString();
listBox1.Sorted = false;
}
private void button3_Click(object sender, EventArgs e)
{
listBox1.Items.Clear();
listBox1.Sorted = false;
}
private void button4_Click(object sender, EventArgs e)
{
try
{
listBox1.Items.RemoveAt(listBox1.SelectedIndex);
}
catch (Exception)
{ //display nothing
}
finally{ // statements to be executed
}
}
private void button2_Click(object sender, EventArgs e)
{
listBox1.Sorted = true;
}
}
}
Output:
3 : Designanapplicationwhichhasthree textboxes.Implementrestrictedpolicyforeach
21SOEIT11003 Enterprise Computing Through .NET Framework (CE525)
Dhvani Bhesaniya 5ITA
textbox toenterdataonlyinnumericform, uppercase,characters
code:
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 LabTut06
{
public partial class Form3 : Form
{
public Form3()
{
InitializeComponent();
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
if (System.Text.RegularExpressions.Regex.IsMatch(textBox1.Text, "[^0-
9]"))
{
MessageBox.Show("Please enter only numbers.");
textBox1.Text = textBox1.Text.Remove(textBox1.Text.Length - 1);
}
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
if( System.Text.RegularExpressions.Regex.IsMatch(textBox2.Text,
"[^A-Z]"))
{
MessageBox.Show("Please enter only upercase string.");
textBox2.Text = textBox2.Text.Remove(textBox2.Text.Length - 1);
}
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
if (System.Text.RegularExpressions.Regex.IsMatch(textBox3.Text, "[^a-
zA-z]"))
{
21SOEIT11003 Enterprise Computing Through .NET Framework (CE525)
Dhvani Bhesaniya 5ITA
MessageBox.Show("Please enter only characters.");
textBox3.Text = textBox3.Text.Remove(textBox3.Text.Length - 1);
}
}
}
}
Output:

More Related Content

Similar to Tutorial 6.docx

10 awt event model
10 awt event model10 awt event model
10 awt event model
Bayarkhuu
 
Vp4
Vp4Vp4
1. Section1.- Populating the list of persons on the person listing f.pdf
1. Section1.- Populating the list of persons on the person listing f.pdf1. Section1.- Populating the list of persons on the person listing f.pdf
1. Section1.- Populating the list of persons on the person listing f.pdf
aniljain719651
 
1. Section1.- Populating the list of persons on the person listing.pdf
1. Section1.- Populating the list of persons on the person listing.pdf1. Section1.- Populating the list of persons on the person listing.pdf
1. Section1.- Populating the list of persons on the person listing.pdf
aniljain719651
 
Needs to be solved with Visual C# from the book Starting oout .pdf
Needs to be solved with Visual C# from the book Starting oout .pdfNeeds to be solved with Visual C# from the book Starting oout .pdf
Needs to be solved with Visual C# from the book Starting oout .pdf
foottraders
 
โครงการ 5 บท
โครงการ 5 บทโครงการ 5 บท
โครงการ 5 บท
MareenaHahngeh
 
โครงการ 5 บท
โครงการ 5 บทโครงการ 5 บท
โครงการ 5 บท
MareenaHahngeh
 
SOLID principles with Typescript examples
SOLID principles with Typescript examplesSOLID principles with Typescript examples
SOLID principles with Typescript examples
Andrew Nester
 
54240326 (1)
54240326 (1)54240326 (1)
54240326 (1)
Vinayak Shedgeri
 
54240326 copy
54240326   copy54240326   copy
54240326 copy
Vinayak Shedgeri
 
Oop lecture8
Oop lecture8Oop lecture8
Oop lecture8
Shahriar Robbani
 
Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5
Bhushan Mulmule
 
Inventory management
Inventory managementInventory management
Inventory management
Rajeev Sharan
 
cs fileusing System; using System.Collections.Generic; using S.pdf
cs fileusing System; using System.Collections.Generic; using S.pdfcs fileusing System; using System.Collections.Generic; using S.pdf
cs fileusing System; using System.Collections.Generic; using S.pdf
arasanlethers
 
Form1.csusing System; using System.Collections.Generic; using .pdf
Form1.csusing System; using System.Collections.Generic; using .pdfForm1.csusing System; using System.Collections.Generic; using .pdf
Form1.csusing System; using System.Collections.Generic; using .pdf
apleather
 
Program.csusing System; using System.Collections.Generic; usin.pdf
Program.csusing System; using System.Collections.Generic; usin.pdfProgram.csusing System; using System.Collections.Generic; usin.pdf
Program.csusing System; using System.Collections.Generic; usin.pdf
anandf0099
 
Dotnet 18
Dotnet 18Dotnet 18
Dotnet 18
dhruvesh718
 
Ejercicio sql server vs visual .net
Ejercicio sql server vs visual .netEjercicio sql server vs visual .net
Ejercicio sql server vs visual .net
Ayuda Universidad
 
12 High Level UI Event Handling
12 High Level UI Event Handling12 High Level UI Event Handling
12 High Level UI Event Handling
corneliuskoo
 
Use the following data set that compares age to average years lef.docx
Use the following data set that compares age to average years lef.docxUse the following data set that compares age to average years lef.docx
Use the following data set that compares age to average years lef.docx
dickonsondorris
 

Similar to Tutorial 6.docx (20)

10 awt event model
10 awt event model10 awt event model
10 awt event model
 
Vp4
Vp4Vp4
Vp4
 
1. Section1.- Populating the list of persons on the person listing f.pdf
1. Section1.- Populating the list of persons on the person listing f.pdf1. Section1.- Populating the list of persons on the person listing f.pdf
1. Section1.- Populating the list of persons on the person listing f.pdf
 
1. Section1.- Populating the list of persons on the person listing.pdf
1. Section1.- Populating the list of persons on the person listing.pdf1. Section1.- Populating the list of persons on the person listing.pdf
1. Section1.- Populating the list of persons on the person listing.pdf
 
Needs to be solved with Visual C# from the book Starting oout .pdf
Needs to be solved with Visual C# from the book Starting oout .pdfNeeds to be solved with Visual C# from the book Starting oout .pdf
Needs to be solved with Visual C# from the book Starting oout .pdf
 
โครงการ 5 บท
โครงการ 5 บทโครงการ 5 บท
โครงการ 5 บท
 
โครงการ 5 บท
โครงการ 5 บทโครงการ 5 บท
โครงการ 5 บท
 
SOLID principles with Typescript examples
SOLID principles with Typescript examplesSOLID principles with Typescript examples
SOLID principles with Typescript examples
 
54240326 (1)
54240326 (1)54240326 (1)
54240326 (1)
 
54240326 copy
54240326   copy54240326   copy
54240326 copy
 
Oop lecture8
Oop lecture8Oop lecture8
Oop lecture8
 
Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5Windows Forms For Beginners Part 5
Windows Forms For Beginners Part 5
 
Inventory management
Inventory managementInventory management
Inventory management
 
cs fileusing System; using System.Collections.Generic; using S.pdf
cs fileusing System; using System.Collections.Generic; using S.pdfcs fileusing System; using System.Collections.Generic; using S.pdf
cs fileusing System; using System.Collections.Generic; using S.pdf
 
Form1.csusing System; using System.Collections.Generic; using .pdf
Form1.csusing System; using System.Collections.Generic; using .pdfForm1.csusing System; using System.Collections.Generic; using .pdf
Form1.csusing System; using System.Collections.Generic; using .pdf
 
Program.csusing System; using System.Collections.Generic; usin.pdf
Program.csusing System; using System.Collections.Generic; usin.pdfProgram.csusing System; using System.Collections.Generic; usin.pdf
Program.csusing System; using System.Collections.Generic; usin.pdf
 
Dotnet 18
Dotnet 18Dotnet 18
Dotnet 18
 
Ejercicio sql server vs visual .net
Ejercicio sql server vs visual .netEjercicio sql server vs visual .net
Ejercicio sql server vs visual .net
 
12 High Level UI Event Handling
12 High Level UI Event Handling12 High Level UI Event Handling
12 High Level UI Event Handling
 
Use the following data set that compares age to average years lef.docx
Use the following data set that compares age to average years lef.docxUse the following data set that compares age to average years lef.docx
Use the following data set that compares age to average years lef.docx
 

Recently uploaded

How to overcome obstacles in the way of success.pdf
How to overcome obstacles in the way of success.pdfHow to overcome obstacles in the way of success.pdf
How to overcome obstacles in the way of success.pdf
Million-$-Knowledge {Million Dollar Knowledge}
 
Connect to Grow: The power of building networks
Connect to Grow: The power of building networksConnect to Grow: The power of building networks
Connect to Grow: The power of building networks
Eirini SYKA-LERIOTI
 
All Of My Java Codes With A Sample Output.docx
All Of My Java Codes With A Sample Output.docxAll Of My Java Codes With A Sample Output.docx
All Of My Java Codes With A Sample Output.docx
adhitya5119
 
thyroid case presentation.pptx Kamala's Lakshaman palatial
thyroid case presentation.pptx Kamala's Lakshaman palatialthyroid case presentation.pptx Kamala's Lakshaman palatial
thyroid case presentation.pptx Kamala's Lakshaman palatial
Aditya Raghav
 
官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
2zjra9bn
 
在线办理(UOIT毕业证书)安大略省理工大学毕业证在读证明一模一样
在线办理(UOIT毕业证书)安大略省理工大学毕业证在读证明一模一样在线办理(UOIT毕业证书)安大略省理工大学毕业证在读证明一模一样
在线办理(UOIT毕业证书)安大略省理工大学毕业证在读证明一模一样
yhkox
 
Community Skills Building Workshop | PMI Silver Spring Chapter | June 12, 2024
Community Skills Building Workshop | PMI Silver Spring Chapter  | June 12, 2024Community Skills Building Workshop | PMI Silver Spring Chapter  | June 12, 2024
Community Skills Building Workshop | PMI Silver Spring Chapter | June 12, 2024
Hector Del Castillo, CPM, CPMM
 
Switching Careers Slides - JoyceMSullivan SocMediaFin - 2024Jun11.pdf
Switching Careers Slides - JoyceMSullivan SocMediaFin -  2024Jun11.pdfSwitching Careers Slides - JoyceMSullivan SocMediaFin -  2024Jun11.pdf
Switching Careers Slides - JoyceMSullivan SocMediaFin - 2024Jun11.pdf
SocMediaFin - Joyce Sullivan
 
按照学校原版(UofT文凭证书)多伦多大学毕业证快速办理
按照学校原版(UofT文凭证书)多伦多大学毕业证快速办理按照学校原版(UofT文凭证书)多伦多大学毕业证快速办理
按照学校原版(UofT文凭证书)多伦多大学毕业证快速办理
evnum
 
Learnings from Successful Jobs Searchers
Learnings from Successful Jobs SearchersLearnings from Successful Jobs Searchers
Learnings from Successful Jobs Searchers
Bruce Bennett
 
体育博彩论坛-十大体育博彩论坛-体育博彩论坛|【​网址​🎉ac55.net🎉​】
体育博彩论坛-十大体育博彩论坛-体育博彩论坛|【​网址​🎉ac55.net🎉​】体育博彩论坛-十大体育博彩论坛-体育博彩论坛|【​网址​🎉ac55.net🎉​】
体育博彩论坛-十大体育博彩论坛-体育博彩论坛|【​网址​🎉ac55.net🎉​】
waldorfnorma258
 
一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理
一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理
一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理
1wful2fm
 
办理阿卡迪亚大学毕业证(uvic毕业证)本科文凭证书原版一模一样
办理阿卡迪亚大学毕业证(uvic毕业证)本科文凭证书原版一模一样办理阿卡迪亚大学毕业证(uvic毕业证)本科文凭证书原版一模一样
办理阿卡迪亚大学毕业证(uvic毕业证)本科文凭证书原版一模一样
kkkkr4pg
 
Leave-rules.ppt CCS leave rules 1972 for central govt employees
Leave-rules.ppt CCS leave rules 1972 for central govt employeesLeave-rules.ppt CCS leave rules 1972 for central govt employees
Leave-rules.ppt CCS leave rules 1972 for central govt employees
Sreenivas702647
 
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAANBUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
cahgading001
 
A Guide to a Winning Interview June 2024
A Guide to a Winning Interview June 2024A Guide to a Winning Interview June 2024
A Guide to a Winning Interview June 2024
Bruce Bennett
 
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
2zjra9bn
 
Lbs last rank 2023 9988kr47h4744j445.pdf
Lbs last rank 2023 9988kr47h4744j445.pdfLbs last rank 2023 9988kr47h4744j445.pdf
Lbs last rank 2023 9988kr47h4744j445.pdf
ashiquepa3
 
Leadership Ambassador club Adventist module
Leadership Ambassador club Adventist moduleLeadership Ambassador club Adventist module
Leadership Ambassador club Adventist module
kakomaeric00
 
0624.speakingengagementsandteaching-01.pdf
0624.speakingengagementsandteaching-01.pdf0624.speakingengagementsandteaching-01.pdf
0624.speakingengagementsandteaching-01.pdf
Thomas GIRARD BDes
 

Recently uploaded (20)

How to overcome obstacles in the way of success.pdf
How to overcome obstacles in the way of success.pdfHow to overcome obstacles in the way of success.pdf
How to overcome obstacles in the way of success.pdf
 
Connect to Grow: The power of building networks
Connect to Grow: The power of building networksConnect to Grow: The power of building networks
Connect to Grow: The power of building networks
 
All Of My Java Codes With A Sample Output.docx
All Of My Java Codes With A Sample Output.docxAll Of My Java Codes With A Sample Output.docx
All Of My Java Codes With A Sample Output.docx
 
thyroid case presentation.pptx Kamala's Lakshaman palatial
thyroid case presentation.pptx Kamala's Lakshaman palatialthyroid case presentation.pptx Kamala's Lakshaman palatial
thyroid case presentation.pptx Kamala's Lakshaman palatial
 
官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
官方认证美国旧金山州立大学毕业证学位证书案例原版一模一样
 
在线办理(UOIT毕业证书)安大略省理工大学毕业证在读证明一模一样
在线办理(UOIT毕业证书)安大略省理工大学毕业证在读证明一模一样在线办理(UOIT毕业证书)安大略省理工大学毕业证在读证明一模一样
在线办理(UOIT毕业证书)安大略省理工大学毕业证在读证明一模一样
 
Community Skills Building Workshop | PMI Silver Spring Chapter | June 12, 2024
Community Skills Building Workshop | PMI Silver Spring Chapter  | June 12, 2024Community Skills Building Workshop | PMI Silver Spring Chapter  | June 12, 2024
Community Skills Building Workshop | PMI Silver Spring Chapter | June 12, 2024
 
Switching Careers Slides - JoyceMSullivan SocMediaFin - 2024Jun11.pdf
Switching Careers Slides - JoyceMSullivan SocMediaFin -  2024Jun11.pdfSwitching Careers Slides - JoyceMSullivan SocMediaFin -  2024Jun11.pdf
Switching Careers Slides - JoyceMSullivan SocMediaFin - 2024Jun11.pdf
 
按照学校原版(UofT文凭证书)多伦多大学毕业证快速办理
按照学校原版(UofT文凭证书)多伦多大学毕业证快速办理按照学校原版(UofT文凭证书)多伦多大学毕业证快速办理
按照学校原版(UofT文凭证书)多伦多大学毕业证快速办理
 
Learnings from Successful Jobs Searchers
Learnings from Successful Jobs SearchersLearnings from Successful Jobs Searchers
Learnings from Successful Jobs Searchers
 
体育博彩论坛-十大体育博彩论坛-体育博彩论坛|【​网址​🎉ac55.net🎉​】
体育博彩论坛-十大体育博彩论坛-体育博彩论坛|【​网址​🎉ac55.net🎉​】体育博彩论坛-十大体育博彩论坛-体育博彩论坛|【​网址​🎉ac55.net🎉​】
体育博彩论坛-十大体育博彩论坛-体育博彩论坛|【​网址​🎉ac55.net🎉​】
 
一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理
一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理
一比一原版美国西北大学毕业证(NWU毕业证书)学历如何办理
 
办理阿卡迪亚大学毕业证(uvic毕业证)本科文凭证书原版一模一样
办理阿卡迪亚大学毕业证(uvic毕业证)本科文凭证书原版一模一样办理阿卡迪亚大学毕业证(uvic毕业证)本科文凭证书原版一模一样
办理阿卡迪亚大学毕业证(uvic毕业证)本科文凭证书原版一模一样
 
Leave-rules.ppt CCS leave rules 1972 for central govt employees
Leave-rules.ppt CCS leave rules 1972 for central govt employeesLeave-rules.ppt CCS leave rules 1972 for central govt employees
Leave-rules.ppt CCS leave rules 1972 for central govt employees
 
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAANBUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
BUKU PENJAGAAN BUKU PENJAGAAN BUKU PENJAGAAN
 
A Guide to a Winning Interview June 2024
A Guide to a Winning Interview June 2024A Guide to a Winning Interview June 2024
A Guide to a Winning Interview June 2024
 
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
在线制作加拿大萨省大学毕业证文凭证书实拍图原版一模一样
 
Lbs last rank 2023 9988kr47h4744j445.pdf
Lbs last rank 2023 9988kr47h4744j445.pdfLbs last rank 2023 9988kr47h4744j445.pdf
Lbs last rank 2023 9988kr47h4744j445.pdf
 
Leadership Ambassador club Adventist module
Leadership Ambassador club Adventist moduleLeadership Ambassador club Adventist module
Leadership Ambassador club Adventist module
 
0624.speakingengagementsandteaching-01.pdf
0624.speakingengagementsandteaching-01.pdf0624.speakingengagementsandteaching-01.pdf
0624.speakingengagementsandteaching-01.pdf
 

Tutorial 6.docx

  • 1. 21SOEIT11003 Enterprise Computing Through .NET Framework (CE525) Dhvani Bhesaniya 5ITA Dhvani Bhesaniya 20SOEIT11003 LAB_TUTORIAL06 5ITA
  • 2. 21SOEIT11003 Enterprise Computing Through .NET Framework (CE525) Dhvani Bhesaniya 5ITA 1 : Design an application like follow. Dependson user selection it will display the message as shown. (If gender is Male then Mr. or Female then Miss) code: 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 LabTut06 { public partial class Form1 : Form { string a, b,c,d,h,i,j,k,l; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { a = textBox1.Text.ToString(); if (radioButton1.Checked) { c = "Mr. "; } else if (radioButton2.Checked) { c = "Miss "; } else { MessageBox.Show("please select any Gender "); } if (checkBox1.Checked) { h = " Newspaper "; } if (checkBox2.Checked)
  • 3. 21SOEIT11003 Enterprise Computing Through .NET Framework (CE525) Dhvani Bhesaniya 5ITA { i = " Website "; } if (checkBox3.Checked) { j = " Friends "; } if (checkBox4.Checked) { b = textBox2.Text.ToString(); } else { MessageBox.Show("please select any source "); } label4.Text = ("Hello "+c+a+" You know about us from "+h+i+j+","+b); } } } Output: 2 : Designa formlike below.ImplementFollowingfunctionalitytothe application.
  • 4. 21SOEIT11003 Enterprise Computing Through .NET Framework (CE525) Dhvani Bhesaniya 5ITA the listbox withitems. itemfromListBox Code: 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 LabTut06 { public partial class Form2 : Form { public Form2() { InitializeComponent(); } private void listBox1_SelectedIndexChanged(object sender, EventArgs e) { label4.Text = listBox1.SelectedItem.ToString(); } private void button1_Click(object sender, EventArgs e) { listBox1.Items.Add("Food For All"); listBox1.Items.Add("Good Books"); listBox1.Items.Add("Freedom of speech"); listBox1.Items.Add("Education "); listBox1.Items.Add("XYZ"); listBox1.Items.Add("Good Movies"); listBox1.Sorted = false; } private void button5_Click(object sender, EventArgs e) {
  • 5. 21SOEIT11003 Enterprise Computing Through .NET Framework (CE525) Dhvani Bhesaniya 5ITA label2.Text = listBox1.Items.Count.ToString(); listBox1.Sorted = false; } private void button3_Click(object sender, EventArgs e) { listBox1.Items.Clear(); listBox1.Sorted = false; } private void button4_Click(object sender, EventArgs e) { try { listBox1.Items.RemoveAt(listBox1.SelectedIndex); } catch (Exception) { //display nothing } finally{ // statements to be executed } } private void button2_Click(object sender, EventArgs e) { listBox1.Sorted = true; } } } Output: 3 : Designanapplicationwhichhasthree textboxes.Implementrestrictedpolicyforeach
  • 6. 21SOEIT11003 Enterprise Computing Through .NET Framework (CE525) Dhvani Bhesaniya 5ITA textbox toenterdataonlyinnumericform, uppercase,characters code: 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 LabTut06 { public partial class Form3 : Form { public Form3() { InitializeComponent(); } private void textBox1_TextChanged(object sender, EventArgs e) { if (System.Text.RegularExpressions.Regex.IsMatch(textBox1.Text, "[^0- 9]")) { MessageBox.Show("Please enter only numbers."); textBox1.Text = textBox1.Text.Remove(textBox1.Text.Length - 1); } } private void textBox2_TextChanged(object sender, EventArgs e) { if( System.Text.RegularExpressions.Regex.IsMatch(textBox2.Text, "[^A-Z]")) { MessageBox.Show("Please enter only upercase string."); textBox2.Text = textBox2.Text.Remove(textBox2.Text.Length - 1); } } private void textBox3_TextChanged(object sender, EventArgs e) { if (System.Text.RegularExpressions.Regex.IsMatch(textBox3.Text, "[^a- zA-z]")) {
  • 7. 21SOEIT11003 Enterprise Computing Through .NET Framework (CE525) Dhvani Bhesaniya 5ITA MessageBox.Show("Please enter only characters."); textBox3.Text = textBox3.Text.Remove(textBox3.Text.Length - 1); } } } } Output: