[go: up one dir, main page]

0% found this document useful (0 votes)
3 views66 pages

Dotnet Lab

The document is a practical lab report for a DotNet programming course at Dr. Umayal Ramanathan College for Women, detailing various programming exercises completed in VB.NET. It includes a bonafide certificate, an index of projects such as a student mark list, electricity bill calculator, and puzzle game, along with their respective coding examples and results. Each exercise demonstrates different programming concepts and successfully verifies the functionality of the applications developed.

Uploaded by

sivakami
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views66 pages

Dotnet Lab

The document is a practical lab report for a DotNet programming course at Dr. Umayal Ramanathan College for Women, detailing various programming exercises completed in VB.NET. It includes a bonafide certificate, an index of projects such as a student mark list, electricity bill calculator, and puzzle game, along with their respective coding examples and results. Each exercise demonstrates different programming concepts and successfully verifies the functionality of the applications developed.

Uploaded by

sivakami
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 66

DOTNETPROGRAMMINGLAB

(22BIT5P1)
Dr.UMAYALRAMANATHANCOLLEGEFORWOMEN
(AccreditedwithB+GradebyNAAC)

Alagappapuram,Karaikudi-630003

DEPARTMENTOFINFORMATIONTECHNOLOGY

BONAFIDECERTIFICATE

This is to certify that the practical work done by


(RegisterNo )isthebonafiderecording
heldintheyear2024.

Staff-Incharge HeadoftheDepartment

SubmittedforUniversityPracticalExaminationin
heldon April24.

ExternalExaminer
INDEX
S.NO DATE TABLEOFCONTENTS PAGE SIGN
NO
01 StudentMarklist 4

02 Electricity Bill 7
03 Calculator 10
04 PuzzleGame 16
05 Image Scrolling 22
06 MouseEvent 24
07 GraphicsFunction 27
08 TextEditor 30
09 AdRotator 35
10 Cookies 38
11 PageCount 41
12 SalaryBill 46

13 ValidatorControl 50

14 WebPage 53

15 GridView 57

3
EXNO:01

DATE: STUDENTMARKLIST

AIM:

Towriteaprogramtocreatethestudentmarklistusingvb.NET.

PROGRAMCODING:
PublicClassForm1

PrivateSubButton1_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button1.Click

TextBox9.Text = Val(TextBox4.Text) +
Val(TextBox5.Text)+Val(TextBox6.Text)
+Val(TextBox7.Text)
+(TextBox8.Text)

End Sub

PrivateSubButton2_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button2.Click

TextBox10.Text=Val(TextBox9.Text)/5

End Sub

PrivateSubButton3_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button3.Click

If TextBox9.Text > 400 Then

TextBox11.Text="EXCELLENT"

EndIf

IfTextBox9.Text<300Then

TextBox11.Text="GOOD"

EndIf

4
IfTextBox9.Text<200Then

TextBox11.Text="POOR"

EndIf

End Sub

PrivateSubButton4_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button4.Click

TextBox1.Text = " "

TextBox1.Text = " "

TextBox1.Text = " "

TextBox1.Text = " "

TextBox1.Text = " "

TextBox1.Text = " "

TextBox1.Text = " "

TextBox1.Text = " "

TextBox1.Text = " "

TextBox1.Text = " "

TextBox1.Text = " "

EndSub

EndClass

OUTPUT:
5
RESULT:

Thustheaboveprogramverifiedsuccessfully.

6
EXNO:02

DATE: ELECTRICITY BILL

AIM:

Towriteaprogramtocreateebbillusingvb.NET.

PROGRAMCODING:
PublicClassForm1
PrivateSubButton1_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button1.Click
Dim Sum As Single
DimUnitAsInteger
IfTextBox1.Text=""OrTextBox2.Text=""Then
MsgBox("enterconsumer number and name")
EndIf
Unit=Val(TextBox3.Text)
If Unit > 300 Then
Sum=(Unit-300)*1.25 Unit =
300
EndIf
IfUnit>200Then
Sum=Sum+(Unit-200)*1 Unit
= 200
EndIf
IfUnit>100Then
Sum=Sum+(Unit-100)*0.85
7
Unit=100
End If
Sum=Sum+Unit*0.5 TextBox4.Text
= Sum
EndSub
End Class

8
OUTPUT:

RESULT:

Thustheaboveprogramverifiedsuccessfully.

9
EXNO:03

DATE: CALCULATOR

AIM:

Towriteaprogramtodesignanddevelopacalculatorusingvb.NET.

PROGRAMCODING:
Public Class Form1
DimaAsInteger
Dimop AsString
PrivateSubButton1_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button1.Click
TextBox1.Text=""En
d Sub
PrivateSubButton2_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Text=TextBox1.Text+Button2.Text
End Sub
PrivateSubButton3_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button3.Click
TextBox1.Text=TextBox1.Text+Button3.Text
End Sub
PrivateSubButton4_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button4.Click
TextBox1.Text=TextBox1.Text+Button4.Text
End Sub

10
PrivateSubButton5_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button5.Click
TextBox1.Text=TextBox1.Text+Button5.Text
End Sub
PrivateSubButton6_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button6.Click
TextBox1.Text=TextBox1.Text+Button6.Text
End Sub
PrivateSubButton7_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button7.Click
TextBox1.Text=TextBox1.Text+Button7.Text
End Sub
PrivateSubButton8_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button8.Click
TextBox1.Text=TextBox1.Text+Button8.Text
End Sub
PrivateSubButton9_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button9.Click
TextBox1.Text=TextBox1.Text+Button9.Text
End Sub
Private Sub Button10_Click(ByVal sender As
System.Object,ByValeAsSystem.EventArgs)Handles
Button10.Click
TextBox1.Text=TextBox1.Text+Button10.Text
End Sub
Private Sub Button11_Click(ByVal sender As
System.Object,ByValeAsSystem.EventArgs)Handles
Button11.Click

11
TextBox1.Text=TextBox1.Text+Button11.Text
End Sub
Private Sub Button12_Click(ByVal sender As
System.Object,ByValeAsSystem.EventArgs)Handles
Button12.Click
a=Val(TextBox1.Text)
TextBox1.Text = ""
op="+"E
nd Sub
Private Sub Button13_Click(ByVal sender As
System.Object,ByValeAsSystem.EventArgs)Handles
Button13.Click
a=Val(TextBox1.Text)
TextBox1.Text = ""
op="-"E
nd Sub
Private Sub Button14_Click(ByVal sender As
System.Object,ByValeAsSystem.EventArgs)Handles
Button14.Click
a=Val(TextBox1.Text)
TextBox1.Text = ""
op="*"E
nd Sub
Private Sub Button15_Click(ByVal sender As
System.Object,ByValeAsSystem.EventArgs)Handles
Button15.Click
a =Val(TextBox1.Text)

12
TextBox1.Text=""o
p = "/"
EndSub
Private Sub Button16_Click(ByVal sender As
System.Object,ByValeAsSystem.EventArgs)Handles
Button16.Click
If op= "+"Then
TextBox1.Text=a+Val(TextBox1.Text)
End If
If op= "-"Then
TextBox1.Text=a-Val(TextBox1.Text)
End If
If op= "*"Then
TextBox1.Text=a*Val(TextBox1.Text)
End If
If op= "/"Then
TextBox1.Text=a/Val(TextBox1.Text)
End If
EndSub
End Class

13
OUTPUT:

RESULT:

Thustheaboveprogramverifiedsuccessfully.

14
EXNO:04

DATE: PUZZLEGAME

AIM:

Towriteaprogramtodesignanddevelopapuzzlegameusingvb.NET.

PROGRAMCODING:
PublicClassForm1
PrivateSubButton1_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button1.Click
If Button2.Text = ""Then
Button2.Text=Button1.Text
Button1.Text = ""
ElseIf Button4.Text = ""Then
Button4.Text=Button1.Text
Button1.Text = ""
EndIf
fin()
EndSub
PrivateSubButton2_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button2.Click
If Button3.Text = ""Then
Button3.Text=Button2.Text
Button2.Text = ""
ElseIf Button1.Text = ""Then
Button1.Text=Button2.Text

15
Button2.Text=""
ElseIf Button5.Text = ""Then
Button5.Text=Button2.Text
Button2.Text = ""
EndIf
fin()
EndSub
PrivateSubButton3_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button3.Click
If Button2.Text = ""Then
Button2.Text=Button3.Text
Button3.Text = ""
ElseIf Button6.Text = ""Then
Button6.Text=Button3.Text
Button3.Text = ""
EndIf
fin()
EndSub
PrivateSubButton4_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button4.Click
If Button1.Text = ""Then
Button1.Text=Button4.Text
Button4.Text = ""
ElseIf Button7.Text = ""Then
Button7.Text=Button4.Text

16
Button4.Text=""
ElseIf button5.text = ""Then
button5.text=button4.text
button4.text = ""
EndIf
fin()
EndSub
PrivateSubButton5_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button5.Click
If Button2.Text = ""Then
Button2.Text=Button5.Text
Button5.Text = ""
ElseIf Button4.Text = ""Then
Button4.Text=Button5.Text
Button5.Text = ""
ElseIf button6.text = ""Then
button6.text=button5.text
button5.text = ""
ElseIf button8.text = ""Then
button8.text=button5.text
button5.text = ""
EndIf
fin()
EndSub

17
PrivateSubButton6_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button6.Click
If Button3.Text = ""Then
Button3.Text=Button6.Text
Button6.Text = ""
ElseIf Button5.Text = ""Then
Button5.Text=Button6.Text
Button6.Text = ""
ElseIf button9.text = ""Then
button9.text=button6.text
button6.text = ""
EndIf
fin()
EndSub
PrivateSubButton7_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button7.Click
If Button4.Text = ""Then
Button4.Text=Button7.Text
Button7.Text = ""
ElseIf Button8.Text = ""Then
Button8.Text=Button7.Text
Button7.Text = ""
EndIf
fin()
EndSub

18
PrivateSubButton8_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button8.Click
If Button5.Text = ""Then
Button5.Text=Button8.Text
Button8.Text = ""
ElseIf Button7.Text = ""Then
Button7.Text=Button8.Text
Button8.Text = ""
ElseIf button9.text = ""Then
button9.text=button8.text
button8.text = ""
EndIf
fin()
EndSub
PrivateSubButton9_Click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button9.Click
If Button6.Text = ""Then
Button6.Text=Button9.Text
Button9.Text = ""
ElseIf Button8.Text = ""Then
Button8.Text=Button9.Text
Button9.Text = ""
EndIf
fin()
EndSub

19
Subfin()
If Button1.Text = "1"And Button2.Text = "2"And
Button3.Text="3"AndButton4.Text="4"AndButton5.Text=
"5"And Button6.Text = "6"And Button7.Text = "7"And
Button8.Text = "8"And Button9.Text = ""Then
Label1.Text = "you
win"Label1.foreColor=color.BlueViol
et
EndIf
End Sub
EndClass

20
OUTPUT:

RESULT:

Thustheaboveprogramverifiedsuccessfully.

21
EXNO:05

DATE: IMAGESCROLLING

AIM:

Towriteaprogramtoscrollimageusingvb.NET.

PROGRAMCODING:
PublicClassForm1
Privatem_panStartPointAsNewPoint
PrivateSubForm1_Load(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Panel1.AutoScroll=True
PictureBox1.SizeMode=PictureBoxSizeMode.AutoSize
End Sub
Private Sub picturebox1_MouseDown(ByVal sender As
Object,ByValeAsSystem.Windows.Forms.MouseEventArgs)
HandlesPictureBox1.MouseDownm_panStartPoi
nt=NewPoint(e.X,e.Y)
EndSub
End Class

22
OUTPUT:

RESULT:

Thustheaboveprogramverifiedsuccessfully.

23
EXNO:06

DATE: MOUSEEVENT

AIM:

Towriteaprogramtodrawapictureusingmouseeventinvb.NET.

PROGRAMCODING:
PublicClassForm1
PrivatelineAsNewList(OfPoint)
Private Sub Form1_MouseDown(ByVal sender As
System.Object,ByValeAsMouseEventArgs)Handles
Me.MouseDown
'starttheline:
line=NewList(OfPoint)()
line.Add(e.Location)
EndSub
Private Sub Form1_MouseMove(ByVal sender As
System.Object,ByValeAsMouseEventArgs)Handles
Me.MouseMove
Ife.Button=Windows.Forms.MouseButtons.LeftThen
'addpointtothelineandinvalidatethe form
totrigger painting
line.Add(e.Location)
Me.Invalidate()
EndIf
End Sub
PrivateSubForm1_Paint(ByValsenderAsObject,ByVale As
PaintEventArgs) Handles Me.Paint
24
'usedrawlinestoconnectupallthepointinthe
line
:
If line.Count > 1 Then
e.Graphics.DrawLines(Pens.Black,line.ToArray)
EndIf
EndSub
End Class

25
OUTPUT:

RESULT:

Thustheaboveprogramverifiedsuccessfully.

26
EXNO:07

DATE: GRAPHICFUNCTION

AIM:

Towriteaprogramtodrawahomeusinggraphicfunctioninvb.NET.

PROGRAMCODING:
PublicClassForm1
PrivateSubForm1_paint(ByValsenderAsSystem.Object,
ByVal e As PaintEventArgs) Handles MyBase.Paint
DimgAsGraphics=e.Graphics 'draw
a simple house
UsingpAsPen=NewPen(Color.Black) 'draw
the upper_leftroof
g.DrawLine(p,NewPoint(50,50),NewPoint(75,
25))
'drawtheupper_rightroof
g.DrawLine(p,NewPoint(75,25),NewPoint(100,
50))
'drawthebody
g.DrawRectangle(p,NewRectangle(50,50,50,
50))
EndUsing
UsingBAsSolidBrush=NewSolidBrush(Color.Yellow)
'fill the sum
g.FillEllipse(B,NewRectangle(0,0,35,35))
End Using

27
UsingBAsSolidBrush=New
SolidBrush(Color.LightBlue)
'fill in the door for the house
g.FillRectangle(B,NewRectangle(60,75,30,
25))
EndUsing
EndSub
End Class

28
OUTPUT:

RESULT:

Thustheaboveprogramverifiedsuccessfully.

29
EXNO:08

DATE: TEXTEDITOR

AIM:

Towriteaprogramtodesignanddevelopatexteditorusingvb.NET.

PROGRAMCODING:
PublicClassForm1
DimMainMenu1AsNew MainMenu()
DimWithEventsmenuitem1AsNewMenuItem()
DimWithEventsmenuitem2AsNewMenuItem()
DimWithEventsmenuitem3AsNewMenuItem()
Dim WithEvents mcopy As New MenuItem()
Dim WithEvents mcut As New
MenuItem()
DimWithEventsmopenAsNewMenuItem()
Dim WithEvents mnew As New
MenuItem()
DimWithEventsmsaveAsNewMenuItem()
DimWithEventsmcodeAsNewMenuItem()
DimWithEventsmdesignerAsNewMenuItem()
PrivateSubbutPublicton1_click(ByValsenderA
s
System.Object,ByValeAsSystem.EventArgs)Handles
Button1.Click
menuitem1.Text="file"
menuitem2.Text="edit"
menuitem3.Text="view"
mnew.Text = "new"
30
mopen.Text="open"
msave.Text="save"
mcopy.Text="copy"
mcut.Text = "cut"
mcut.Shortcut=Shortcut.Ctrl
X mcopy.Checked = True
mcode.Text =
"code"mdesigner.Text =
"Designer"menuitem1.MenuIte
ms.Add(mnew)
menuitem1.MenuItems.Add(mop
en)
menuitem1.MenuItems.Add(msa
ve)
menuitem2.MenuItems.Add(mco
py)
menuitem2.MenuItems.Add(mcu
t)
MainMenu1.MenuItems.Add(menuitem
1)
MainMenu1.MenuItems.Add(menuitem
2)
MainMenu1.MenuItems.Add(menuitem
3)
menuitem3.MenuItems.Add(mcode)

31
menuitem3.MenuItems.Add(mdesigne
r) Menu = MainMenu1
EndSub
PrivateSubbutton2_click(ByValsenderAsSystem.Object,
ByVal e As System.EventArgs) Handles Button2.Click
En
d
EndSub

32
PrivateSubCopyToolStripMenuItem_Click(ByValsenderAs
Object, ByVal e As EventArgs) Handles
CopyToolStripMenuItem.Click
Clipboard.SetText(TextBox1.SelectedText
) End Sub
PrivateSubCutToolStripMenuItem_Click(ByValsenderAs
Object, ByVal e As EventArgs) Handles
CutToolStripMenuItem.Click
TextBox1.Cut()
TextBox1.SelectedText=""
EndSub
PrivateSubPasteToolStripMenuItem_Click(ByValsenderA
s Object, ByVal e As EventArgs) Handles
PasteToolStripMenuItem.Click
TextBox1.SelectedText=Clipboard.GetTex
t End Sub
PrivateSubSaveToolStripMenuItem_Click(ByValsenderAs
Object, ByVal e As EventArgs) Handles
SaveToolStripMenuItem.Click
SaveFileDialog1.Filter="TXTFiles(*.txt*)|
*.txt"If SaveFileDialog1.ShowDialog =
Windows.Forms.DialogResult.OKThen

My.Computer.FileSystem.WriteAllText(SaveFileDialog1.FileName
,TextBox1.Text,True)
End If
EndSub

33
PrivateSubOpenToolStripMenuItem_Click(ByValsenderAs
Object, ByVal e As EventArgs) Handles
OpenToolStripMenuItem.Click
OpenFileDialog1.Filter="JPGFiles(*.jpg*)|
*.jpg"If OpenFileDialog1.ShowDialog =
Windows.Forms.DialogResult.OKThen

My.Computer.FileSystem.WriteAllText(OpenFileDialog1.FileName
,TextBox1.Text,True)
End If
EndSub
End Class

34
OUTPUT:

RESULT:

Thustheaboveprogramverifiedsuccessfully.

35
EXNO:09

DATE: ADROTATOR

AIM:

Towriteaasp.NETprogramusingadrotator.

PROGRAM:

WEBFORM.ASPX:

<%@ Page
Language="C#"AutoEventWireup="true"CodeBehind="WebForm1.aspx.
cs"Inherits="adrotator.WebForm1"
%>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML 1.0
Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title>SOFTDRINGS</title>
</head>
<body>
<formid="form1"runat="server">
<div>
<asp:AdRotatorID="AdRotator1"runat="server"AdvertisementF
ile="~/XMLFile1.xml"
Target="_blank"/>

</div>
</form>
</body>
</html>
XMLFILE.XML:
<?xmlversion="1.0"encoding="utf-8"?>
<Advertisements>
<Ad>

35
<ImageUrl>C:\Users\A.KANNAN\Pictures\png\
Screenshot 2024-10-17 143748.png</ImageUrl>
<NavigateUrl>http://www.pepsi.com</NavigateUrl>
<AlternativeText>Pepsi</AlternativeText>
<Keyword>softdrinks</Keyword>
<Impressions>2</Impressions>
</Ad>
<Ad>

<ImageUrl>"C:\Users\A.KANNAN\Pictures\png\
Screenshot.png"</I mageUrl>
<NavigateUrl>http://www.cocacola.com</NavigateUrl>
<AlternativeText>Cocacola</AlternativeText>
<Keyword>softdrinks</Keyword>
<Impressions>2</Impressions>

</Ad>
</Advertisements>

36
OUTPUT:

RESULT:

Thustheaboveprogramverifiedsuccessfully.

37
EXNO:10

DATE: COOKIES

AIM:

Towriteaasp.NETprogramusingcookies.

PROGRAMCODING:
usingSystem;
usingSystem.Collections.Generic;
using System.Linq;
using System.Web;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;

namespacecookies
{
publicpartialclassWebForm1:System.Web.UI.Page
{
protectedvoidPage_Load(objectsender,EventArgse)
{
HttpCookiecookie1=newHttpCookie("john");
if (cookie1 == null)
Label1.Text="<b>cookiefound</b><br><br>";
Label2.Text="welcome"+
cookie1.Name.ToString();

38
}
protectedvoidButton1_Click(objectsender,
EventArgs e)
{
HttpCookiecookie2;
cookie2 = new HttpCookie("preference");
cookie2.Name = TextBox1.Text;
cookie2.Expires=DateTime.Now.AddYears(1)
; Response.Cookies.Add(cookie2);
Label1.Text="<br>cookiescreated</b><br><br>";
Label2.Text="newcustomer:"+
cookie2.Name.ToString();
}
}
}

39
OUTPUT:

RESULT:

Thustheaboveprogramverifiedsuccessfully.

40
EXNO:11

DATE: PAGECOUNT

AIM:

Towriteaasp.NETprogramtofindthepagecountdetailsusing application
object.

PROGRAMCODING:

I)ASP.NET
usingSystem;
usingSystem.Collections.Generic;
using System.Linq;
using System.Web;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;

namespacepagecount
{
publicpartialclassWebForm1:System.Web.UI.Page
{
protectedvoidPage_Load(objectsender,EventArgse)
{
Response.Write("theuserhasvisitthepage="+
Application["user"].ToString());
Response.Write("time");
Response.Write("<br><br>");
41
Response.Write("issessionnew="+
Session.IsNewSession);
Response.Write("<br><br>no.ofsession"+
Session.Count);

protectedvoidButton1_Click1(objectsender,
EventArgs e)
{
Session["name"] = TextBox1.Text;
Response.Write("<br><br>thisis<br><br>"+
Session["name"]+"<br><br>session");
}
}
}
II)GLOBAL.AXPX
usingSystem;
usingSystem.Collections.Generic;
using System.Linq;
usingSystem.Web;
using System.Web.Security;
usingSystem.Web.SessionState
; namespace page.aspx
{
publicclassGlobal: System.Web.HttpApplication

42
{

voidApplication_Start(objectsender,EventArgse)
{
Application["user"]=0;
}

voidApplication_End(objectsender,EventArgse)
{
}

voidApplication_Error(objectsender,EventArgse)
{
}

voidSession_Start(objectsender,EventArgse)
{
Application.Lock();
Application["User"]=(int)Application["user"] +
1;
Application.UnLock();
}

voidSession_End(objectsender,EventArgse)
{

43
Application.Lock();
Application["user"]=(int)Application["user"] -
1;
Application.UnLock();
}

}
}

44
OUTPUT:

RESULT:

Thustheaboveprogramverifiedsuccessfully.

45
EXNO:12

DATE: SALARYBILL

AIM:

TOWriteaasp.Netprogramtoprepareasalarybill.

PROGRAMCODING:

Webform1.aspx

<
%@PageLanguage="vb"AutoEventWireup="false"CodeBehind="W
ebForm1.aspx.vb"Inherits="WebApplication1.WebForm1"%>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML 1.0
Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-
transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title></title>
</head>
<body>
<formid="form1"runat="server">
<div>

</div>
<asp:LabelID="Label1"runat="server"Text="Name"></
asp:Label>
&nbsp;
<asp:TextBoxID="TextBox1"runat="server"></
asp:TextBox>&nbsp;<br />
<asp:LabelID="Label2"runat="server"Text="Basic
salary"></asp:Label>
<asp:TextBoxID="TextBox2"runat="server"></asp:TextBox>
<br/>
<asp:LabelID="Label3"runat="server"Text="TA"></
asp:Label>

46
<asp:TextBoxID="TextBox3"runat="server"></asp:TextBox>
<br/>
<asp:LabelID="Label4"runat="server"
Text="DA"></asp:Label>
<asp:TextBoxID="TextBox4"runat="server"></asp:TextBox>
<br/>
<asp:LabelID="Label5"runat="server"
Text="HRA"></asp:Label>
<asp:TextBoxID="TextBox5"runat="server"></asp:TextBox>
<br/>
<asp:LabelID="Label6"runat="server"
Text="Pf"></asp:Label>
<asp:TextBoxID="TextBox6"runat="server"></asp:TextBox>
<br/>
<asp:LabelID="Label7"runat="server"
Text="Ins"></asp:Label>
<asp:TextBoxID="TextBox7"runat="server"></asp:TextBox>
<br/>
<asp:LabelID="Label8"runat="server"
Text="Allo"></asp:Label>
<asp:TextBoxID="TextBox8"runat="server"></asp:TextBox>
<br/>
<asp:LabelID="Label9"runat="server"
Text="Deduction"></asp:Label>
<asp:TextBoxID="TextBox9"runat="server"></asp:TextBox>
<br/>
<asp:LabelID="Label10"runat="server"Text="Net
salary"></asp:Label>
<asp:TextBoxID="TextBox10"runat="se
rver"></asp:TextBox>
<br/>
<asp:LabelID="Label11"runat="server
"Text="Gross"></asp:Label>
<asp:TextBoxID="TextBox11"runat="se
rver"></asp:TextBox>
<br/>
<br /
>&nbsp;&nbsp;&nbsp;

47
<asp:ButtonID="Button1"runat="server"Text="click"Wi
dth="141px" />
<br/>
<br/>
</form>
</body>
</html>
BUTTONCODE

Public Class WebForm1


InheritsSystem.Web.UI.Pa
ge

ProtectedSubPage_Load(ByValsenderAsObject,ByVale As
System.EventArgs) Handles Me.Load

EndSub

ProtectedSubButton1_Click(ByValsenderAsObject,
ByVal e As EventArgs) Handles Button1.Click

TextBox4.Text=25/100*Val(TextBox2.Text)
TextBox3.Text = 5 / 100 * Val(TextBox2.Text)
TextBox5.Text=10/100*Val(TextBox2.Text)
TextBox6.Text=12/100*Val(TextBox2.Text)
TextBox7.Text=10/100*Val(TextBox2.Text)
TextBox8.Text = Val(TextBox3.Text) +
Val(TextBox4.Text) + Val(TextBox5.Text)
TextBox9.Text=Val(TextBox6.Text)+
Val(TextBox7.Text)
TextBox10.Text=Val(TextBox2.Text)+
Val(TextBox8.Text) - Val(TextBox9.Text)
TextBox11.Text=Val(TextBox2.Text)+
Val(TextBox8.Text)
EndSub
End Class

48
OUTPUT:

RESULT:

Thustheaboveprogramverifiedsuccessfully.

49
EXNO:13

DATE: VALIDATIONCONTROL

AIM:

Towriteaasp.NETprogramtodesignthebiodataformwithvalidation control.

PROGRAMCODING:
usingSystem;
usingSystem.Collections.Generic;
using System.Linq;
using System.Web;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;

namespacevalidation_controls
{
publicpartialclassWebForm1:System.Web.UI.Page
{
protectedvoidPage_Load(objectsender,EventArgse)
{

protectedvoidButton1_Click(objectsender,
EventArgs e)

50
{
if(Page.IsValid==false)
Label6.Text="thisisnotvalid"; else
Label6.Text="thisisvalid";
}

protectedvoidButton2_Click(objectsender,
EventArgs e)
{
Label6.Text="retry";
}
}
}

51
OUTPUT:

RESULT:

Thustheaboveprogramverifiedsuccessfully.

52
EXNO:14

DATE: WEBPAGE

AIM:

Towriteaprogramtocreatethewebpageusingmasterpagewith navigation
control.

PROGRAMCODING:
Webapplication8.aspx

<%@ Page Title="Home


Page"Language="C#"MasterPageFile="~/Site.master"AutoEventWire
up="true"
CodeBehind="Homepage.aspx.cs"Inherits="WebApplication8._D
efault"%>

<asp:ContentID="HeaderContent"runat="server"ContentPlaceHolde
rID="HeadContent">
</asp:Content>
<asp:ContentID="BodyContent"runat="server"ContentPlaceHolderI
D="MainContent">
<h2>
WelcometoInformationTechnology
</h2>
<p>
To learn more about us visit <a
href="http://www.umayalwomenscollege.co.in"title="urcw
Website">urcw</a>.
</p>
<p>
You can also find <a
href="https://umayalwomenscollege.co.in/courses/depart
ment- of-information-technology/"
>IT</a>.
</p>
</asp:Content>

53
Stylesheet.css
head
{
font-size:
.120em; text-
align:justify;
color:Black
}
body
{
background:#b7b6bb
; font-size:
.80em;
font-
family:"calibiri","BookAntiqua","courier";
margin:0 Px;
text-align:center;
padding:0 Px;
color:red;
}

a:link,a:visited
{
color:maroon;
}

a:hover
{
color:#1d60ff;
text-decoration:none;
}

a:active
{
color:#034af3;
}
Site.master

<
%@MasterLanguage="C#"AutoEventWireup="true"CodeBehind="
54
Site.master.cs"Inherits="WebApplication8.SiteMaster"%>

55
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Strict//
EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-
strict.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml"xml:lang="en">
<headrunat="server">

<linkhref="~/
StyleSheet2.css"rel="stylesheet"type="text/css" />
<asp:ContentPlaceHolderID="HeadContent"runat="server">
</asp:ContentPlaceHolder>
<h1>Dr.UmayalRamanathanCollegeforWomen</h1>
</head>
<body>
<asp:ContentPlaceHolderID="MainContent"runat="server">
</asp:ContentPlaceHolder>
<formrunat="server">

</form>
</body>
</html>

56
OUTPUT:

RESULT:

Thustheaboveprogramverifiedsuccessfully.

57
EXNO:15

DATE: GRIDVIEW

AIM:

ToWriteaprogramtodisplaythesalesitemrecordsusinggridviewcontrol with
data binding.

PROGRAMCODING:

Webform.aspx

<
%@PageLanguage="C#"AutoEventWireup="true"CodeBehind="We
bForm16.aspx.cs"Inherits="WebApplication5.WebForm16"%>

<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML 1.0
Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/
xhtml1-transitional.dtd">

<formid="form1"runat="server">
<tablewidth="100%">
<tr>
<td>ItemName</td>
<td></td>
<td>
<asp:textboxid="TextBox1"runat="server"xmlns:
asp="#unknown"></asp:textbox></td>
</tr>
<tr>
<tdstyle="margin-left:40px">QuantityName<br/>
<asp:LabelID="Label1"runat="server"Text="Price
"></asp:Label>
</td>
<td></td>
<td>

<asp:textboxid="TextBox2"runat="server"xmlns:asp="
#unknown"></asp:textbox>
58
<br/>

59
<asp:TextBoxID="TextBox3"runa
t="server"></asp:TextBox>
</td>
</tr>
<tr>
<tdcolspan="3">
<asp:buttonid="Button1"runat="server"text="Add
"onclick="Button1_Click"xmlns:asp="#unknown" />
</td>
</tr>
</table>
<br/>
<asp:gridviewid="GridView1"runat="server"xmlns:asp="#un
known">
</asp:gridview>

</form>

Webform16.aspx.cs

usingSystem;
usingSystem.Collections.Generic;
using System.Linq;
using System.Web;
usingSystem.Web.UI;
usingSystem.Web.UI.WebControls;
using System.Data;

namespaceWebApplication5
{
publicpartialclassWebForm16:System.Web.UI.Page
{
protectedvoidPage_Load(objectsender,EventArgse)
{

if (!IsPostBack)
{

60
DataTabledt=newDataTable();
dt.Columns.Add("Item name");
dt.Columns.Add("Quantity");
dt.Columns.Add("Price");
DataRow dr = dt.NewRow();
dr[0]="PonniRice";
dr[1] = "20 kgs";
dr[2]="1000";
dt.Rows.Add(dr);

Session["TempData"] =
dt;
GridView1.DataSource=dt;
GridView1.DataBind();
}
}
protectedvoidButton1_Click(objectsender,
EventArgs e)
{
DataTabledt=(DataTable)Session["TempData"];

DataRowdr=dt.NewRow();
dr[0] = TextBox1.Text;

dr[1] = TextBox2.Text;
dr[2] = TextBox3.Text;
dt.Rows.Add(dr);
Session["TempData"]=dt;
GridView1.DataSource =
(DataTable)Session["TempData"];
GridView1.DataBind();
}
}}

61
OUTPUT:

RESULT:

Thustheaboveprogramverifiedsuccessfully.

62

You might also like