Dotnet Lab
Dotnet Lab
Dotnet Lab
Maitidevi, Kathmandu
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 WindowsFormsApp10
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
}
}
Output
LAB 2- Write a program to display the use of case when
statement to display area of different types of shape
using System;
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Choose a shape to calculate its area:");
Console.WriteLine("1. Circle");
Console.WriteLine("2. Rectangle");
Console.WriteLine("3. Triangle");
Console.WriteLine("Enter your choice (1, 2, or 3):");
switch (choice)
{
case 1:
Console.WriteLine("Enter the radius of the circle:");
double radius = double.Parse(Console.ReadLine());
double circleArea = Math.PI * radius * radius;
Console.WriteLine($"Area of the circle: {circleArea}");
break;
case 2:
Console.WriteLine("Enter the length of the rectangle:");
double length = double.Parse(Console.ReadLine());
Console.WriteLine("Enter the width of the rectangle:");
double width = double.Parse(Console.ReadLine());
double rectangleArea = length * width;
Console.WriteLine($"Area of the rectangle: {rectangleArea}");
break;
case 3:
Console.WriteLine("Enter the base of the triangle:");
double triangleBase = double.Parse(Console.ReadLine());
Console.WriteLine("Enter the height of the triangle:");
double height = double.Parse(Console.ReadLine());
double triangleArea = 0.5 * triangleBase * height;
Console.WriteLine($"Area of the triangle: {triangleArea}");
break;
default:
Console.WriteLine("Invalid choice!");
break;
}
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 WindowsFormsApp13
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Output
LAB 4 - Write a program to insert, update and delete a record
of student into a database in a Windows Form Based
Application.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace WindowsFormsApp6
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
con.Close();
MessageBox.Show("Successfully Saved");
}
Update
Delete
LAB 5- Write a program to show list of Employee in Web form
application and filter it using employee name, contact no and
email address.
CodeBehind=”AllEmployeesDetails.aspx.cs”
Inherits=”SamWebProject.AllEmployeesDetails” %>
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=”http://www.w3.org/1999/xhtml">
<head runat=”server”>
<title></title>
</head>
<body>
<h1>WebService Sample</h1>
<div>
<div>
<asp:GridView ID=”GVEmployeeDetails” runat=”server” CellPadding=”4"
ForeColor=”#333333" GridLines=”None”>
ForeColor=”#333333" />
</asp:GridView>
</div>
</form>
</body>
</html>
Home.aspx Code File
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Xml;
namespace SamWebProject
if (!IsPostBack)
BindEmployeeDetails();
}
SamWebService.SamWebService1();
if (exelement != null)
dsResult.ReadXml(nodeReader, XmlReadMode.Auto);
GVEmployeeDetails.DataSource = dsResult;
GVEmployeeDetails.DataBind();
}
Output