Using System

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

using System; {

using System.Collections.Generic; grpstudentdetail.Enabled = true;

using System.ComponentModel; txtname.Focus();

using System.Data; }

using System.Drawing;

using System.Linq; private void btnresult_Click(object


sender, EventArgs e)
using System.Text;
{
using System.Threading.Tasks;
grpresult.Visible = true;
using System.Windows.Forms;
double totalresult;

double percentageresult;
namespace WindowsFormsApp1
char graderesult;
{

public partial class Form1 : Form

{
totalresult =
public Form1() Convert.ToInt32(txtmath.Text) +
{ Convert.ToInt32(txtphysics.Text) +
Convert.ToInt32(txtchemistry.Text) +
InitializeComponent(); Convert.ToInt32(txtenglish.Text);

} lbltotalresult.Text =
totalresult.ToString();

private void groupBox1_Enter(object


sender, EventArgs e) percentageresult =
Convert.ToInt32(totalresult * 100 / 400);
{
lblpercentageresult.Text =
percentageresult.ToString() + "%";
}

if (percentageresult > 80)


private void btnedit_Click(object {
sender, EventArgs e)
lblgraderesult.Text = "A-1"; }

} else if (percentageresult > 30)

else if (percentageresult > 70) {

lblgraderesult.Text = "F";

{ }

lblgraderesult.Text = "A";

} }

else if (percentageresult > 60) private void btnreset_Click(object


sender, EventArgs e)

{
{
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.Threading.Tasks; richTextBox1.Text = "";

using System.Windows.Forms; }

namespace WindowsFormsApp3 private void


menufileopen_Click(object sender,
{ EventArgs e)
public partial class Notepad : Form {
{

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();

sv.Filter = "Text Document(*.txt)|


*.txt|all Files(*.*)|*.*"; private void menueditcut_Click(object
sender, EventArgs e)
if (sv.ShowDialog() ==
DialogResult.OK) {

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(); }

} }

You might also like