0% found this document useful (0 votes)
35 views

System : Using

The document contains code for three C# console or Windows forms applications. The first application defines classes and methods for tracking object counts and displaying values. The second application demonstrates creating object instances and calling static and instance methods. The third application defines a form with controls for displaying text, entering a name and numbers, and performing basic calculations by adding numbers.

Uploaded by

Rehan Sabir
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

System : Using

The document contains code for three C# console or Windows forms applications. The first application defines classes and methods for tracking object counts and displaying values. The second application demonstrates creating object instances and calling static and instance methods. The third application defines a form with controls for displaying text, entering a name and numbers, and performing basic calculations by adding numbers.

Uploaded by

Rehan Sabir
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 10

using

System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Windows.Forms;
namespace
WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private voidfontToolStripMenuItem_Click(object
sender,EventArgs e)
{
FontDialog fd = new FontDialog();
fd.ShowColor =
true;
fd.ShowDialog();
richTextBox1.SelectionFont = fd.Font;
richTextBox1.SelectionColor = fd.Color;
}
private voidzoomInToolStripMenuItem_Click(objec
t sender,EventArgs e)
{
richTextBox1.ZoomFactor += 1;
}
private voidzoomOutToolStripMenuItem_Click(obje
ct sender,EventArgs e)
{
richTextBox1.ZoomFactor -= 1;
}
}
}


















using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Text;
namespace
ConsoleApplication1
{
class A
{
int num;
static int count=0;
public A()
{
count++;
num = 0;
}
public int Num
{
get { return num; }
set { num = value; }
}
public void display()
{
Console.WriteLine(A.count);
Console.WriteLine(num);
}
public static void show()
{
Console.WriteLine(A.count);
//Console.WriteLine(num);
}


}
class Program
{
static void Main(string[] args)
{
A o1 = new A();
o1.display();
A o2 = new A();
A.show();
A o3 = new A();
o1.display();
A o4 = new A();
A.show();
}
}
}










using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Linq;
using
System.Text;
using
System.Windows.Forms;
namespace
WindowsFormsApplication1
{
public partial class Form1 : Form
{
int num1;
public Form1()
{
InitializeComponent();
}
private void btnClick_Click(object sender,Event
Args e)
{
lblText.Text =
"Hello " + txtName.Text;
}
private void btn1_Click(object sender,EventArgs
e)
{
txtCalc.Text +=
"1";
}
private void btn2_Click(object sender,EventArgs
e)
{
txtCalc.Text +=
"2";
}
private void btn3_Click(object sender,EventArgs
e)
{
txtCalc.Text +=
"3";
}
private void Form1_Load(object sender,EventArgs
e)
{
}
private void button8_Click(object sender,EventA
rgs e)
{
}
private void btnP_Click(object sender,EventArgs
e)
{
num1=
Convert.ToInt32(txtCalc.Text);
txtCalc.Text =
"";
}
private void btnE_Click(object sender,EventArgs
e)
{
txtCalc.Text= (num1 +
int.Parse(txtCalc.Text)) .ToString();
}
}
}

You might also like