NET Lab Manual
NET Lab Manual
no:1
Aim:
To write a program for factorial number in [Link] using windows
form application.
Algorithm:
1. Start the program
2. Open ->Visual Studio 2008->File->
New Project->Visual C#->Windows Form Application
3. Design the page with controls as per table.
4. Write the coding in source code page.
5. Save the program.
6. Run the program.
7. Stop the program.
1
Form design:
2
Source code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As [Link], ByVal e
As [Link]) Handles [Link]
[Link] = fact(Val([Link]))
End Sub
Function fact(ByVal a As Integer) As Long
Dim K As Integer
fact = 1
For k = a To 1 Step -1
fact *= k
Next
End Function
End Class
3
Output:
Result:
Thus the program has been executed successfully.
4
[Link]
Aim:
To write a program for finding the biggest and smallest of three
numbers in [Link] using windows form application.
Algorithm:
1. Start the program
2. Open ->Visual Studio 2008->File->New Project->Visual c#-
>Windows Form Application
3. Design the page with controls as per table.
4. Write the coding in source code page.
5. Save the program.
6. Run the program.
7. Stop the program.
5
Form design:
6
Source code:
Public Class Form1
Private Sub Button1_Click(ByVal sender As [Link], ByVal e
As [Link]) Handles [Link]
Dim f As Integer
Dim s As Integer
Dim t As Integer
Dim sma As Integer
Dim lar As Integer
f = Val([Link])
s = Val([Link])
t = Val([Link])
If f > s Then
lar = f
Else
lar = s
End If
If lar < t Then
lar = t
End If
If lar < s Then
sma = f
Else
sma = s
End If
If sma > t Then
sma = t
End If
[Link] = lar
[Link] = sma
End Sub
End Class
7
Output:
Result:
Thus the program has been executed successfully.
8
[Link]
Aim:
To write a program for displaying the message in rich text box in
[Link] using windows form application.
Algorithm:
1. Start the program
2. Open ->Visual Studio 2008->File->New Project->Windows
->Windows Form Application
3. Design the page with controls as per table.
4. Write the coding in source code page.
5. Save the program.
6. Run the program.
7. Stop the program.
9
Form design:
10
Source code:
Public Class Form1
11
Output:
Result:
Thus the program has been executed successfully.
12
[Link]
Aim:
To write a program for adding two numbers in [Link] using windows
form application.
Algorithm:
13
Form design:
14
Source code:
Public Class Form1
15
Output:
Result:
Thus the program has been executed successfully.
16
[Link]
Aim:
To write a program for image blink in [Link] using windows form
application.
Algorithm:
1. Start the program
2. Open ->Visual Studio 2008->File->New Project->Visual c#
->Windows Form Application
3. Design the page with controls as per table.
4. Write the coding in source code page.
5. Save the program.
6. Run the program.
7. Stop the program.
17
Form design:
18
Source code:
Public Class Form1
19
Output:
Result:
Thus the program has been executed successfully.
20
[Link]
Aim:
To write a program for stop clock in [Link] using windows form
application.
Algorithm:
1. Start the program
2. Open ->Visual Studio 2008->File->New Project->Visual C#-
>windows from Application.
3. Write the coding in source code page.
4. Save the program.
5. Run the program.
6. Stop the program.
21
Form design:
22
Source code:
Public Class Form1
23
Output:
Result:
Thus the program has been executed successfully.
24
[Link]
Aim:
To write a program for progress bar in [Link] using windows Form
application.
Algorithm:
1. Start the program
2. Open ->Visual Studio 2008->File->New Project->Visual C#
->Windows Form Application
3. Design the page with controls as per table.
4. Write the coding in source code page.
5. Save the program.
6. Run the program.
7. Stop the program.
25
Form design:
26
Source code:
Public Class Form1
End If
End Sub
End Sub
End Class
27
Output:
Result:
Thus the program has been executed successfully.
28
[Link]
Aim:
To write a program for birthday difference in [Link] using windows
Form application
Algorithm:
1. Start the program
2. Open ->Visual Studio 2008->File->New Project->Visual C#
->Windows Form Application
3. Design the page with controls as per table.
4. Write the coding in source code page.
5. Save the program.
6. Run the program.
7. Stop the program.
29
Form design:
30
Source code:
Public Class form1
Private Sub Button1_Click(ByVal sender As [Link], ByVal e
As [Link]) Handles [Link]
Dim dob As Date = Format(CDate([Link]), "dd/MM/yyyy")
[Link] = DateDiff([Link], dob, Now)
[Link] = DateDiff([Link], dob, Now)
[Link] = DateDiff([Link], dob, Now)
[Link] = WeekdayName([Link], False,
[Link])
End Sub
End Class
31
Output:
Result:
Thus the program has been executed successfully.
32
[Link]
Date: calculator
Aim:
To write a program for calculating tax in [Link] using windows form
application.
ALGORITHM:
1. Start the program
2. Open ->Visual Studio 2008->File->New Project->Visual c#
->Windows Form Application
3. Design the page with controls as per table.
4. Write the coding in source code page.
5. Save the program.
6. Run the program.
7. Stop the program.
33
Form design:
34
Source code:
Public Class Form1
Dim fnum As Decimal
Dim snum As Decimal
Dim operation As Integer
Dim oper_select As Boolean = False
37
Private Sub Button15_Click(ByVal sender As [Link], ByVal
e As [Link]) Handles [Link]
fnum = [Link]
[Link] = "0"
oper_select = True
operation = 3
End Sub
38
[Link] = fnum - snum
ElseIf operation = 3 Then
[Link] = fnum * snum
Else
If snum = 0 Then
[Link] = "error!"
Else
[Link] = fnum / snum
End If
If oper_select = False Then
End If
End If
End Sub
End Class
39
Output:
Result:
Thus the program has been executed successfully.
40
[Link]
Aim:
To write a program for structure using console application in [Link].
Algorithm:
1. Start the program
2. Open ->Visual Studio 2008->File->New Project->Visual c#-
>Console Application.
3. Write the coding in source code page.
4. Save the program.
5. Run the program.
6. Stop the program.
41
Source code:
Module Module1
Public Enum Gender
Male = 1
female = 2
End Enum
Public Structure customer
Dim firstname As String
Dim lastname As String
Dim Gender As Gender
Dim fuladdress As Address
Dim cellphone As String
Dim email As String
End Structure
Public Structure address
Dim Streetaddress As String
Dim city As String
Dim state As String
Dim zip As String
End Structure
Sub Main()
Dim objcustomer As customer
With objcustomer
.firstname = "Suba"
.lastname = "mass"
.Gender = [Link]
.cellphone = "9488120431"
.email = "suba0305@[Link]"
With .fuladdress
.Streetaddress = "surulipatti southstreet"
.city = "cumbum"
.state = "tamilnadu"
.zip = "00006"
End With
End With
[Link]("the customer name:" & [Link] &
"" & [Link] & vbCrLf & [Link] &
42
"address:" & [Link] &
[Link] & "," & [Link] &
"," & [Link])
[Link]()
End Sub
End Module
43
Output:
Result:
Thus the program has been executed successfully.
44
[Link] using c#
45
[Link]
Aim:
To write a program for finding in [Link] using Web application.
Algorithm:
1. Start the program
2. Open ->Visual Studio 2008->File->New Project->Visual C#-
>Web
->[Link] Web Application
3. Design the page with controls as per table.
4. Write the coding in source code page.
5. Save the program.
6. Run the program.
7. Stop the program.
46
Form design:
47
CONTROLS CAPTION NAME Field validator
LABEL1 LOGIN LABEL1 _
FORM
VALIDATI
ON
LABEL2 USER LABEL2 REQUIRED FIELD
NAME VALIDATOR
LABEL3 EMAIL LABEL3 REGULAR
EXPRESSION
VALIDATOR
LABEL4 PASSWOR LABEL4 REQUIRED FIELD
D VALIDATOR
LABEL5 CONFIRM LABEL5 REQUIRED FIELD
PASSWOR VALIDATOR AND
D COMPARE
VALIDATOR
LABEL6 COUNTRY LABEL6 REQUIRED
VALIDATOR
TEXTBOX1 _ TEXTBOX1 _
TEXTBOX2 _ TEXTBOX2 _
TEXTBOX3 _ TEXTBOX3 _
TEXTBOX4 _ TEXTBOX4 _
DROPDOW _ DROPDOW _
NBOX1 NBOX1
BUTTON1 SUBMIT BUTTON1 _
48
Source code:
Partial Class _Default
Inherits [Link]
49
Output:
Result:
Thus the program has been executed successfully.
50
[Link]
Aim:
To write a program for finding in [Link] using Visual c# in [Link]
Web application.
Algorithm:
1. Start the program
2. Open ->Visual Studio 2008->File->New Project->Visual c#-
>Web->Web Application
3. Design the page with controls as per table.
4. Write the coding in source code page.
5. Save the program.
6. Run the program.
7. Stop the program.
51
Source code:
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageUrl>[Link]</ImageUrl>
<AlternateText>Invalid</AlternateText>
<NavigateUrl></NavigateUrl>
</Ad>
<Ad>
<ImageUrl>[Link]</ImageUrl>
<AlternateText>Invalid</AlternateText>
<NavigateUrl></NavigateUrl>
</Ad>
</Advertisements>
52
Output:
Result:
Thus the program has been executed successfully.
53
[Link]
Date: hotspot
Aim:
To write a program for finding in [Link] using Visual c# in [Link]
Web application.
Algorithm:
1. Start the program
54
Form design:
55
Source code:
Partial Class _Default
Inherits [Link]
56
Output:
Result:
Thus the program has been executed successfully.
57
[Link]
Aim:
To write a program for finding in [Link] using Visual c# in [Link]
Web application.
Algorithm:
1. Start the program
2. Open ->Visual Studio 2008->File->New Project->Visual c#-
>Web->Web Application
3. Design the page with controls as per table.
4. Write the coding in source code page.
5. Save the program.
6. Run the program.
7. Stop the program.
58
Source code:
Public Class Form1
Dim speed As Integer
Dim road(7) As PictureBox
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles
[Link]
speed = 3
road(0) = PictureBox1
road(1) = PictureBox2
road(2) = PictureBox3
road(3) = PictureBox4
road(4) = PictureBox5
road(5) = PictureBox6
road(6) = PictureBox7
road(7) = PictureBox8
End Sub
Private Sub Timer9_Tick(sender As Object, e As EventArgs)
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles
[Link]
For x As Integer = 0 To 7
road(x).Top += 2
If road(x).Top >= [Link] Then
road(x).Top = -road(x).Height
End If
59
Next
End Sub
Private Sub PictureBox9_Click(sender As Object, e As EventArgs)
End Sub
End Sub
Private Sub left_mover_Tick(sender As Object, e As EventArgs)
Handles left_mover.Tick
If ([Link].X > 0) Then
[Link] -= 5
End If
End Sub
Private Sub right_mover_Tick(sender As Object, e As EventArgs)
Handles right_mover.Tick
If ([Link].X < 190) Then
[Link] += 5
End If
End Sub
End Sub
Private Sub Enemy1_mover_Tick(sender As Object, e As EventArgs)
Handles Enemy1_mover.Tick
[Link] += 2
If [Link] >= [Link] Then
[Link] = -[Link]
End If
End Sub
60
Private Sub Enemy2_mover_Tick(sender As Object, e As EventArgs)
Handles Enemy2_mover.Tick
[Link] += 3
End Sub
Private Sub Enemy3_mover_Tick(sender As Object, e As EventArgs)
Handles Enemy3_mover.Tick
[Link] += 2.5
End Sub
61
Output:
Result:
Thus the program has been executed successfully.
62
[Link]
Date: Cookies
Aim:
To write a program for finding in [Link] using Visual c# in [Link]
Web application.
Algorithm:
1. Start the program
2. Open ->Visual Studio 2008->File->New Project->Visual c#-
>Web->Web Application
3. Design the page with controls as per table.
4. Write the coding in source code page.
5. Save the program.
6. Run the program.
7. Stop the program.
63
Form design:
64
Source code:
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
namespace WebApplication2
{
public partial class _Default : [Link]
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
[Link]["uname"].Value = [Link];
[Link]["pass"].Value = [Link];
[Link]["uname"].Expires = [Link](2);
[Link]["pass"].Expires = [Link](2);
}
Result:
Thus the program has been executed successfully.
66
[Link]
Aim:
To write a program for finding in [Link] using Visual c# in [Link]
Web application.
Algorithm:
1. Start the program
2. Open ->Visual Studio 2008->File->New Project->Visual c#-
>Web->Web Application
3. Design the page with controls as per table.
4. Write the coding in source code page.
5. Save the program.
6. Run the program.
7. Stop the program.
67
Form design:
68
Source code:
Bank home master
<%@ Master Language="C#" AutoEventWireup="true"
CodeBehind="[Link]" Inherits="bankapp.bankhome1" %>
69
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
<h1 align="center">
Welcome To Bank..........
</h1>
</asp:Content>
New branch
<%@ Page Language="C#" MasterPageFile="~/[Link]"
AutoEventWireup="true" CodeBehind="New [Link]"
Inherits="bankapp.WebForm2" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
<br /><br /><br /><br /><br /><br /><br /><br />
New Branch Content goes here.........
<br /><br /><br /><br /><br /><br /><br /><br />
</asp:Content>
New customer
<%@ Page Language="C#" MasterPageFile="~/[Link]"
AutoEventWireup="true" CodeBehind="New [Link]"
Inherits="bankapp.WebForm3" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
70
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
<br /><br /><br /><br /><br /><br /><br /><br />
New Customer Content goes here.........
<br /><br /><br /><br /><br /><br /><br /><br />
</asp:Content>
Generate report
<%@ Page Language="C#" MasterPageFile="~/[Link]"
AutoEventWireup="true" CodeBehind="Generate [Link]"
Inherits="bankapp.WebForm4" Title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1"
runat="server">
<br /><br /><br /><br /><br /><br /><br /><br />
New Branch Content goes here.........
<br /><br /><br /><br /><br /><br /><br /><br />
</asp:Content>
71
Output:
Result:
Thus the program has been executed successfully
72
[Link]
Aim:
To write a program for finding in [Link] using Visual c# in [Link]
Web application.
Algorithm:
1. Start the program
2. Open ->Visual Studio 2008->File->New Project->Visual c#-
>Web->Web Application
3. Design the page with controls as per table.
4. Write the coding in source code page.
5. Save the program.
6. Run the program.
7. Stop the program.
73
FORM DESIGN:
TEXTBOX3 _ TEXTBOX3
DROPDOWN THENI
LIST BOX
BUTTON1 TOTAL BUTTON1
LABEL5 - LABEL5
LABEL6 - LABEL6
LABEL7 - LABEL7
LABEL8 - LABEL8
74
SOURCE CODE:
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
namespace address
{
public partial class _Default : [Link]
{
protected void Page_Load(object sender, EventArgs e)
{
75
Output:
Result:
Thus the program has been executed successfully
76
[Link]
Aim:
To write a program for finding in [Link] using Visual c# in [Link]
Web application.
Algorithm:
1. Start the program
2. Open ->Visual Studio 2008->File->New Project->Visual c#-
>Web->Web Application
3. Design the page with controls as per table.
4. Write the coding in source code page.
5. Save the program.
6. Run the program.
7. Stop the program.
77
FORM DESIGN:
78
SOURCE CODE:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="[Link]" Inherits="WebApplication4._Default"
%>
<br />
<asp:Button ID="Button1" runat="server" Text="<<"
onclick="Button1_Click" />
<asp:Button ID="Button2" runat="server" onclick="Button2_Click"
Text=">>" />
</div>
</form>
</body>
</html>
79
View code:
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
80
Output:
Result:
Thus the program has been executed successfully.
81
[Link]
Date: sessions
Aim:
To write a program for creating sessions using [Link] Web
application.
Algorithm:
1. Start the program
2. Open ->Visual Studio 2008->File->New Project->Visual c#-
>Web->Web Application
3. Design the page with controls as per table.
4. Write the coding in source code page.
5. Save the program.
6. Run the program.
7. Stop the program.
82
Form design:
83
Source code:
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
namespace sse
{
public partial class _Default : [Link]
{
protected void Button1_Click(object sender, EventArgs e)
{
Session["Some Data"] = [Link];
}
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
84
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
namespace sse
{
public partial class WebForm1 : [Link]
{
protected void Button1_Click(object sender, EventArgs e)
{
[Link] = Session["Some Data"].ToString();
}
}
}
85
Output:
Result:
Thus the program has been executed successfully.
86
[Link]
Aim:
To write a program for finding in [Link] using Visual c# in [Link]
Web application.
Algorithm:
1. Start the program
2. Open ->Visual Studio 2008->File->New Project->Visual c#-
>Web->Web Application
3. Design the page with controls as per table.
4. Write the coding in source code page.
5. Save the program.
6. Run the program.
7. Stop the program.
87
Form design:
88
design code:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="[Link]"
Inherits="WebApplication32._Default" %>
90
<asp:Parameter Name="AGE" Type="String" />
<asp:Parameter Name="original_ID" Type="Int32" />
<asp:Parameter Name="original_S_NO" Type="String" />
<asp:Parameter Name="original_REGISTTER_NUMBER"
Type="String" />
<asp:Parameter Name="original_STUDENT_NAME" Type="String"
/>
<asp:Parameter Name="original_AGE" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="ID" Type="Int32" />
<asp:Parameter Name="S_NO" Type="String" />
<asp:Parameter Name="REGISTTER_NUMBER" Type="String" />
<asp:Parameter Name="STUDENT_NAME" Type="String" />
<asp:Parameter Name="AGE" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</div>
</form>
</body>
</html>
91
OUTPUT:
Result :
Thus the program has been executed successfully.
92