Dotnet tutorial
Dotnet tutorial
Tutorial – 2
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Security.AccessControl;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Calculator
int count;
public Calculator()
InitializeComponent();
inp.Text = inp.Text + 1;
inp.Text = inp.Text + 2;
inp.Text = inp.Text + 3;
inp.Text = inp.Text + 4;
inp.Text = inp.Text + 5;
inp.Text = inp.Text + 6;
inp.Text = inp.Text + 7;
inp.Text = inp.Text + 8;
inp.Text = inp.Text + 9;
inp.Text = inp.Text + 0;
else
inp.Clear();
num = float.Parse(inp.Text);
inp.Clear();
inp.Focus();
count = 1;
num = float.Parse(inp.Text);
inp.Clear();
inp.Focus();
count = 2;
num = float.Parse(inp.Text);
inp.Clear();
inp.Focus();
count = 3;
num = float.Parse(inp.Text);
inp.Clear();
inp.Focus();
count = 4;
num = float.Parse(inp.Text);
inp.Focus();
count = 5;
inp.Text = inp.Text.Remove(0);
switch (count)
case 1:
inp.Text = ans.ToString();
break;
case 2:
inp.Text = ans.ToString();
break;
case 3:
inp.Text = ans.ToString();
break;
inp.Text = ans.ToString();
break;
inp.Text = inp.Text.Remove(1);
int c = inp.TextLength;
int flag = 0;
if (text[i].ToString() == ".")
flag = 1; break;
else
flag = 0;
if (flag == 0)
Output:
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 Student
{
public partial class AddStudent : Form
{
public AddStudent()
{
InitializeComponent();
}
name.Text = name.Text;
email.Text = email.Text;
enroll.Text = enroll.Text;
colr.AnyColor = true;
var fd = new System.Windows.Forms.OpenFileDialog();
fd.Filter = "jpg files|*.jpg";
if (red.Checked == true)
{
if (colr.ShowDialog() == DialogResult.OK)
{
BackColor = colr.Color;
}
}
else
{
if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string fileToOpen = fd.FileName;
System.IO.FileInfo File = new System.IO.FileInfo(fd.FileName);
BackgroundImage = Image.FromFile(fd.FileName);
}
}
if (forcor.ShowDialog() == DialogResult.OK)
{
ForeColor = forcor.Color;
title.ForeColor = forcor.Color;
display.ForeColor = forcor.Color;
}
display.Visible = true;
display.Text = name.Text + "\n" + email.Text +"\n"+enroll.Text;
}
}
Output: