SlideShare a Scribd company logo
Windows Form - Lec12 (Workshop on C# Programming: Learn to Build)
C#
Day 2
Lecture12: Form Design
Form Design: MessageBox
using System;
using System.Text;
using System.Windows.Forms;
public class HelloWorld
{
public static void Main()
{
MessageBox.Show("Hello World!");
}
}
Form Design: TextBox
private void button1_Click(object sender, EventArgs e)
{
text1.Text = textBox1.Text.ToString();
text2.Text = textBox2.Text.ToString();
MessageBox.Show("You've successfully logged in.","Log in");
}
Form Design: Label
private void button1_Click(object sender, EventArgs e)
{
label1.Text = label1.Text.ToString().ToUpper();
label2.Text = label2.Text.ToString().ToLower();
MessageBox.Show("You've successfully logged in.","Log in");
}
Form Design: CheckBox
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if(checkBox1.Checked)
textBox2.UseSystemPasswordChar = false;
else
textBox2.UseSystemPasswordChar = true;
}
}
Form Design: CheckBox
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text.ToString();
textBox2.Text = textBox2.Text.ToString();
MessageBox.Show("You've successfully logged in.","Log in");
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked)
{ textBox2.UseSystemPasswordChar = false; }
else
{ textBox2.UseSystemPasswordChar = true; }
}
Form Design: RadioButton
string radio="radio";
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
radio = "Button1";
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
radio = "Button2";
}
Form Design: PictureBox
private void pictureBox1_Click(object sender, EventArgs e)
{
pictureBox1.SizeMode.GetType();
}
Windows Form Design
• Let's design a Form.
Windows Form - Lec12 (Workshop on C# Programming: Learn to Build)
Windows Form - Lec12 (Workshop on C# Programming: Learn to Build)
Windows Form Design: Make PDF
• Write some code to generate a PDF.
• Hint:
- First design a form
- Use some methods
Windows Form Design: Make PDF
Windows Form Design: Make PDF
using System.IO;
using iTextSharp.text;
using iTextSharp.text.pdf;
private void button1_Click(object sender, EventArgs e)
{ Document doc = new Document(iTextSharp.text.PageSize.LETTER, 25, 25, 30, 20);
PdfWriter myPDF = PdfWriter.GetInstance(doc, new FileStream(textBox1.Text.ToString()
+ ".pdf", FileMode.Create));
Paragraph pri = new Paragraph(textBox2.Text.ToString());
doc.Open();
doc.Add(pri);
doc.Close();
MessageBox.Show("Saved");
}
This slide is provided as a course material in the workshop named
“Workshop on C# Programming: Learn to Build”.
Organized by-
East West University Computer Programming Club (EWUCoPC)
Prepared by-
Jannat Binta Alam
Campus Ambassador
Young Engineers Society (YES)
E-mail: jannat.cse.ewu@gmail.com

More Related Content

DOCX
CRUD VB2010
PPTX
CloudBrew: Windows Azure Mobile Services - Next stage
PDF
Visual Studio.Net - Sql Server
PDF
SISTEMA DE FACTURACION (Ejemplo desarrollado)
PDF
Membuat aplikasi penjualan buku sederhana
DOCX
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
PDF
Twitter Fabric (Türkçe)
PDF
The Ring programming language version 1.9 book - Part 82 of 210
CRUD VB2010
CloudBrew: Windows Azure Mobile Services - Next stage
Visual Studio.Net - Sql Server
SISTEMA DE FACTURACION (Ejemplo desarrollado)
Membuat aplikasi penjualan buku sederhana
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
Twitter Fabric (Türkçe)
The Ring programming language version 1.9 book - Part 82 of 210

Similar to Windows Form - Lec12 (Workshop on C# Programming: Learn to Build) (20)

DOCX
Tutorial 6.docx
PPTX
Chapter ii c#(building a user interface)
PDF
Windows Forms For Beginners Part 5
PDF
Calculator Program in C#.NET
TXT
Tips android
PDF
Inventory management
PDF
Ditec esoft C# project
PDF
Ditec esoft C# project
PPTX
gad presentation 222. Shrewe df dsf vfdsg
PPTX
PROGRAMMING USING C#.NET SARASWATHI RAMALINGAM
DOCX
Create our own keylogger
DOCX
Create our own keylogger
DOCX
Microsoft Visual C# 2012- An introduction to object-oriented programmi.docx
PPT
PPT
06 win forms
DOCX
DOCX
DOCX
โครงการ 5 บท
DOCX
โครงการ 5 บท
PDF
Creating a Facebook Clone - Part XXXV - Transcript.pdf
Tutorial 6.docx
Chapter ii c#(building a user interface)
Windows Forms For Beginners Part 5
Calculator Program in C#.NET
Tips android
Inventory management
Ditec esoft C# project
Ditec esoft C# project
gad presentation 222. Shrewe df dsf vfdsg
PROGRAMMING USING C#.NET SARASWATHI RAMALINGAM
Create our own keylogger
Create our own keylogger
Microsoft Visual C# 2012- An introduction to object-oriented programmi.docx
06 win forms
โครงการ 5 บท
โครงการ 5 บท
Creating a Facebook Clone - Part XXXV - Transcript.pdf
Ad

More from Jannat Ruma (10)

PPTX
Class C# - Lec11 (Workshop on C# Programming: Learn to Build)
PPTX
String C# - Lec10 (Workshop on C# Programming: Learn to Build)
PPTX
Method C# - Lec8 (Workshop on C# Programming: Learn to Build)
PPTX
Loop C# - Lec7 (Workshop on C# Programming: Learn to Build)
PPTX
Decision Making C# - Lec6 (Workshop on C# Programming: Learn to Build)
PPTX
Variable C# - Lec5 (Workshop on C# Programming: Learn to Build)
PPTX
Type Casting C# - Lec4 (Workshop on C# Programming: Learn to Build)
PPTX
Operator C# - Lec3 (Workshop on C# Programming: Learn to Build)
PPTX
Data Type C# - Lec2 (Workshop on C# Programming: Learn to Build)
PPTX
C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)
Class C# - Lec11 (Workshop on C# Programming: Learn to Build)
String C# - Lec10 (Workshop on C# Programming: Learn to Build)
Method C# - Lec8 (Workshop on C# Programming: Learn to Build)
Loop C# - Lec7 (Workshop on C# Programming: Learn to Build)
Decision Making C# - Lec6 (Workshop on C# Programming: Learn to Build)
Variable C# - Lec5 (Workshop on C# Programming: Learn to Build)
Type Casting C# - Lec4 (Workshop on C# Programming: Learn to Build)
Operator C# - Lec3 (Workshop on C# Programming: Learn to Build)
Data Type C# - Lec2 (Workshop on C# Programming: Learn to Build)
C# Basic - Lec1 (Workshop on C# Programming: Learn to Build)
Ad

Recently uploaded (20)

PPTX
How to Manage Starshipit in Odoo 18 - Odoo Slides
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PPTX
Onica Farming 24rsclub profitable farm business
PDF
Module 3: Health Systems Tutorial Slides S2 2025
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PDF
English Language Teaching from Post-.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
The Final Stretch: How to Release a Game and Not Die in the Process.
PPTX
Cardiovascular Pharmacology for pharmacy students.pptx
PPTX
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
PPTX
NOI Hackathon - Summer Edition - GreenThumber.pptx
PPTX
UNDER FIVE CLINICS OR WELL BABY CLINICS.pptx
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
Open Quiz Monsoon Mind Game Prelims.pptx
PDF
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
How to Manage Starshipit in Odoo 18 - Odoo Slides
human mycosis Human fungal infections are called human mycosis..pptx
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
Onica Farming 24rsclub profitable farm business
Module 3: Health Systems Tutorial Slides S2 2025
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
English Language Teaching from Post-.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
The Final Stretch: How to Release a Game and Not Die in the Process.
Cardiovascular Pharmacology for pharmacy students.pptx
Nursing Management of Patients with Disorders of Ear, Nose, and Throat (ENT) ...
NOI Hackathon - Summer Edition - GreenThumber.pptx
UNDER FIVE CLINICS OR WELL BABY CLINICS.pptx
STATICS OF THE RIGID BODIES Hibbelers.pdf
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Open Quiz Monsoon Mind Game Prelims.pptx
Mga Unang Hakbang Tungo Sa Tao by Joe Vibar Nero.pdf
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...

Windows Form - Lec12 (Workshop on C# Programming: Learn to Build)

  • 3. Form Design: MessageBox using System; using System.Text; using System.Windows.Forms; public class HelloWorld { public static void Main() { MessageBox.Show("Hello World!"); } }
  • 4. Form Design: TextBox private void button1_Click(object sender, EventArgs e) { text1.Text = textBox1.Text.ToString(); text2.Text = textBox2.Text.ToString(); MessageBox.Show("You've successfully logged in.","Log in"); }
  • 5. Form Design: Label private void button1_Click(object sender, EventArgs e) { label1.Text = label1.Text.ToString().ToUpper(); label2.Text = label2.Text.ToString().ToLower(); MessageBox.Show("You've successfully logged in.","Log in"); }
  • 6. Form Design: CheckBox private void checkBox1_CheckedChanged(object sender, EventArgs e) { if(checkBox1.Checked) textBox2.UseSystemPasswordChar = false; else textBox2.UseSystemPasswordChar = true; } }
  • 7. Form Design: CheckBox private void button1_Click(object sender, EventArgs e) { textBox1.Text = textBox1.Text.ToString(); textBox2.Text = textBox2.Text.ToString(); MessageBox.Show("You've successfully logged in.","Log in"); } private void checkBox1_CheckedChanged(object sender, EventArgs e) { if (checkBox1.Checked) { textBox2.UseSystemPasswordChar = false; } else { textBox2.UseSystemPasswordChar = true; } }
  • 8. Form Design: RadioButton string radio="radio"; private void radioButton1_CheckedChanged(object sender, EventArgs e) { radio = "Button1"; } private void radioButton2_CheckedChanged(object sender, EventArgs e) { radio = "Button2"; }
  • 9. Form Design: PictureBox private void pictureBox1_Click(object sender, EventArgs e) { pictureBox1.SizeMode.GetType(); }
  • 10. Windows Form Design • Let's design a Form.
  • 13. Windows Form Design: Make PDF • Write some code to generate a PDF. • Hint: - First design a form - Use some methods
  • 15. Windows Form Design: Make PDF using System.IO; using iTextSharp.text; using iTextSharp.text.pdf; private void button1_Click(object sender, EventArgs e) { Document doc = new Document(iTextSharp.text.PageSize.LETTER, 25, 25, 30, 20); PdfWriter myPDF = PdfWriter.GetInstance(doc, new FileStream(textBox1.Text.ToString() + ".pdf", FileMode.Create)); Paragraph pri = new Paragraph(textBox2.Text.ToString()); doc.Open(); doc.Add(pri); doc.Close(); MessageBox.Show("Saved"); }
  • 16. This slide is provided as a course material in the workshop named “Workshop on C# Programming: Learn to Build”. Organized by- East West University Computer Programming Club (EWUCoPC) Prepared by- Jannat Binta Alam Campus Ambassador Young Engineers Society (YES) E-mail: [email protected]