Using System
Using System
Using System
using System.Data; }
using System.Drawing;
double percentageresult;
namespace WindowsFormsApp1
char graderesult;
{
{
totalresult =
public Form1() Convert.ToInt32(txtmath.Text) +
{ Convert.ToInt32(txtphysics.Text) +
Convert.ToInt32(txtchemistry.Text) +
InitializeComponent(); Convert.ToInt32(txtenglish.Text);
} lbltotalresult.Text =
totalresult.ToString();
lblgraderesult.Text = "F";
{ }
lblgraderesult.Text = "A";
} }
{
{
txtname.ResetText();
lblgraderesult.Text = "B";
txtclass.ResetText();
}
txtsection.ResetText();
txtrollno.ResetText();
else if (percentageresult > 50)
txtmath.ResetText();
txtphysics.ResetText();
{
txtchemistry.ResetText();
lblgraderesult.Text = "C";
txtenglish.ResetText();
}
lbltotalresult.ResetText();
lblpercentageresult.ResetText();
else if (percentageresult > 40)
lblgraderesult.ResetText();
}
{
}
lblgraderesult.Text = "D";
}
Lab 2 private void Form1_Load(object
sender, EventArgs e)
using System;
{
using System.Collections.Generic;
using System.ComponentModel;
}
using System.Data;
using System.Drawing;
private void menufilenew_Click(object
using System.Linq; sender, EventArgs e)
using System.Text; {
using System.Windows.Forms; }
public Notepad()
{ // Create an OpenFileDialog to
request a file to open.
InitializeComponent();
OpenFileDialog openFile1 = new
}
OpenFileDialog();
private void
newToolStripMenuItem_Click(object
sender, EventArgs e) // Determine whether the user
selected a file from the OpenFileDialog.
{
if (openFile1.ShowDialog() ==
DialogResult.OK)
}
// Load the contents of the file
into the RichTextBox.
private void
menueditcopy_Click(object sender,
richTextBox1.LoadFile(openFile1.FileName, EventArgs e)
RichTextBoxStreamType.PlainText);
{
this.Text = openFile1.FileName;
richTextBox1.Copy();
}
private void
menueditpaste_Click(object sender,
EventArgs e)
private void menufilesave_Click(object
sender, EventArgs e) {
{ richTextBox1.Paste();
SaveFileDialog sv = new }
SaveFileDialog();
richTextBox1.Cut();
richTextBox1.SaveFile(sv.FileName,
RichTextBoxStreamType.PlainText); }
this.Text = sv.FileName;
} private void
menueditdelete_Click(object sender,
EventArgs e)
private void {
menueditundo_Click(object sender,
EventArgs e) richTextBox1.SelectedText = "";
{ }
richTextBox1.Undo(); }
} }