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

Web Technology Lab Manual

The document outlines various programs implemented in VB.NET and C# including finding the factorial value, comparing numbers, arithmetic operations, and other basic programs. It provides the code, design, and output for each program implemented as windows form or web applications.

Uploaded by

uma devi
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)
14 views

Web Technology Lab Manual

The document outlines various programs implemented in VB.NET and C# including finding the factorial value, comparing numbers, arithmetic operations, and other basic programs. It provides the code, design, and output for each program implemented as windows form or web applications.

Uploaded by

uma devi
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/ 75

DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

CONTENT

S.NO DATE PROGRAMS PG.NO SIGN

VB.NET

1.
Find the Factorial Value

2.
Find the Biggest & Smallest
Number

3.
Arithmetic Operation

4.
File &Folder Control

5.
Progress Bar

6.
List view Control

7.
Simple Login Form Without
Database

8.
Automatic Compute Age
Using DateTimePicker
9.
Error Handling

1
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

C#-WINDOWS FROM APPLICATION

10.
Google Map

11.
Insert, Delete, and Update the
Data in DataGridView without
using Database.

C#-WEB APPLICATION

12.
Display the Tweets Using
DataGridView Control with
MS-Access

13.
Query String Collection

14.
ADRotator Control

15. Image Slider

16. Registration Form Validation

2
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

EX.NO:1
DATE: FIND THE FACTORIAL VALUE

AIM:

To write a VB.NET program to find the factorial value using Windows Form
Application.

ALGORITHM:

1. Start  Visual Studio 2008


2. Click file >> new >> project >> visual basic >> windows >> windows
form application.
3. Place three label box in the form design page and named it as enter
the number, result, label.
4. Place a button in the Centre and named it as generate. Double-click on
the button and give the codings.
5. Save the program
6. Run the program

3
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

FORM DESIGN:

PROPERTIES:

CONTROLS TEXT NAME

Label1 factorial number Label1

Label2 Enter the number Label2

Label3 Result Label3

Label4 - Label4

Textbox1 - Textbox1

Button1 Generate Button1

4
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

SOURCE CODE:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
TextBox2.Text = fact(Val(TextBox1.Text))
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

5
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

OUTPUT:

RESULT:
Thus the program has been successfully executed.

6
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

EX.NO:2
FIND THE BIGGEST & SMALLEST
NUMBERS
DATE:

AIM:

To write a VB.NET program to find the biggest and smallest of three numbers using
Windows Form Application.

ALGORITHM:

1. Start the program.


2. Open Microsoft visual studio 2008.
3. Go to file->new project->visual basic->windows->windows form application.
4. Design the page with the required tools.
5. Change the properties for the selected tools.
6. Select the tools used in the design page and write code accordingly.
7. Save and run the program.
8. Stop the program.

7
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

FORM DESIGN:

PROPERTIES:

CONTROLS TEXT NAME

Label1 BIGGEST NUMBER Label1

Label2 First Number Label2

Label3 Second Number Label3

Label4 Third number Label4

Label5 Biggest Label5

Label6 Smallest Label6

Label7 - Label7

Label8 - Label8

Button Compare Button1

8
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

SOURCE CODE:
Public class form1
Private sub button1_click (Byval Sender As System-object,Byval e As System.EventArgs)Handles
button1.click
Dim f As Integer
Dim s As Integer
Dim t As Integer
Dim sma As Integer
Dim lar As Integer
F=val(Textbox1.text)
S=val(Textbox2.Text)
T=val(Textbox3.Text)
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
Label7.Text=lar
Lable8.text=sma
End Sub

9
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

OUTPUT:

RESULT:
Thus the program has been successfully executed.

10
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

EX.NO:3
ARITHMETIC OPERATION
DATE:

AIM:

To write a VB.NET program to find the Arithmetic operation using Windows


Form Application.

ALGORITHM:

1. Start visual studio 2008.


2. Go to file->new project->visual basic->windows->windows form application.
3. Place a label box and named as arithmetic operation.
4. Place a three label box and named it as number1, number2, result.
5. Place three text box parallel to the label boxes in the form
6. Place five button and named as an add, sub, mul, div, clear. Double click on each
buttons and give the codings.
7. Save the program.
8. Run the program.
9. End the program

11
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

FORM DESIGN:

PROPERTIES:

CONTROLS TEXT NAME


ARITHMETIC
Label 1 Label 1
OPERATION
Label 2 Number 1 Label 2
Label 3 Number 2 Label 3
Result
Label 4 Label 4
-
Text box 1 Text box 1
Text box 2
Text box 2 -

Text box 3 - Text box 3


Add
Button 1 Button 1
Sub
Button 2 Button 2
Mul
Button 3 Button 3
Div
Button 4 Button 4
Clear
Button 5 Button 5

12
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

SOURCE CODE:
Public Class Form1
Dim number1 AsInteger
Dim number2 As Integer
Dim result AsInteger
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
number1 = TextBox1.Text
number2 = TextBox2.Text
result = number1 + number2
TextBox3.Text = result
EndSub
PrivateSub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
number1 = TextBox1.Text
number2 = TextBox2.Text
result = number1 - number2
TextBox3.Text = result
EndSub
PrivateSub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
number1 = TextBox1.Text
number2 = TextBox2.Text
result = number1 * number2
TextBox3.Text = result
EndSub
PrivateSub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button4.Click
number1 = TextBox1.Text
number2 = TextBox2.Text
result = number1 / number2
TextBox3.Text = result
EndSub

13
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

PrivateSub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button5.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
EndSub
EndClass

14
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

OUTPUT:

RESULT:
Thus the program has been successfully executed.

15
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

EX.NO:4
FILE & FOLDER CONTROL
DATE:

AIM:

To write a VB.NET program to find the File & Folder Control using Windows
Form Application.

ALGORITHM:

1. Start the program.


2. Open Microsoft visual studio 2008.
3. Go to file-> project-> visual basic-> windows-> windows form application.
4. Design the page with the required tools.
5. Double-click on the button and write the code accordingly.
6. Save & run the program.
7. Stop the program.

16
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

FORM DESIGN:

PROPERTIES:

CONTROLS TEXT NAME

Label1 File&Folder Control Label1

Label2 Selected folder Label2

Label3 Selected file Label3

Textbox1 Textbox1

Textbox2 Textbox2

Radiobutton1 Folder Open Radiobutton1

Radiobutton2 File Open Radiobutton2

Openfiledialog1 Openfiledialog1

Folderbrowserdialog1 Folderbrowserdialog1

Button1 OK Button1

Groupbox1 Groupbox1

17
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

SOURCE CODE:
PublicClass Form1
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
If RadioButton1.Checked = TrueThen
FolderBrowserDialog1.ShowDialog()
TextBox1.Text = FolderBrowserDialog1.SelectedPath
Else
OpenFileDialog1.ShowDialog()
TextBox2.Text = OpenFileDialog1.FileName
EndIf
EndSub
EndClass

18
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

OUTPUT:

RESULT:
Thus the program has been successfully executed.

19
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

EX.NO:5
PROGRESS BAR
DATE:

AIM:

To write a VB.NET program to find the Progress Bar using Windows Form
Application.

ALGORITHM:
1. Open Microsoft Visual Studio 2008.

2. Go to file->new project->visual basic->windows->windows form application.

3. In the toolbox, click and drag three label boxes, two textboxes, a progress bar and a timer.
Rename the label boxes according to the program.

4. Change the interval of timer to 100.

5. Double click on the button and give the codings.

6. Save the program.

7. Run the program.

8. End the program.

20
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

FORM DESIGN:

PROPERTIES:

CONTROLS TEXT NAME

Label1 PROGRESS BAR Label1

Label2 Username Label2

Label3 Password Label3

Textbox1 - Textbox1

Textbox2 - Textbox2

Button1 Login Button1

ProgressBar1 - ProgressBar1

Timer1 Interval- 100 Timer1

21
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

SOURCE CODE:
Public class Form1

Private sub form_load(Byval Sender As System-object,Byval e As System.EventArgs)Handles

MyBase.load

progressBar1.Minimum=0

progressBar1.Maximum=100

End Sub

Private Sub Timer1_Tick (Byval Sender As System-object,Byval e As System.EventArgs)Handles

Timer1.Tick

progressBar1.value=progressBar1.value+5

Label1.Text=progressBar1.value&”%”&”completed”

If progressbar1.value>=100 then

Timer.Enabled=False

If Textbox1.Text=”CS” And Textbox2.Text=”123” then

MsgBox(“Welcome”,MsgBoxStyle.Information “CS GIRLS”)

progressBar1.value=0

Else

MsgBox(“Invalid user name”,MsgBoxStyle.Information,”CS GIRLS”)

Label1.Text= ““

progressBar1.value=0

TextBox1.Focus ()

End If

End If

22
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

End Sub

Private Sub Button1_click (Byval Sender As System-object,Byval e As System.EventArgs)Handles


Button1.click

Timer1.Enabled=True

End Sub

End Class

23
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

OUTPUT:

RESULT:

Thus the program has been successfully executed.

24
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

EX.NO:6
LISTVIEW CONTROL
DATE:

AIM:
To write a VB.NET program to display students marksheet using listview control in
Windows Form Application.

ALGORITHM:
1. Open Microsoft visual studio 2008.
2. Click file >> select new >> new project >> visual basic>> windows form application.
3. From the toolbox,
4. Click and drag 9 label boxes and rename them.
5. Click and drag 8 textboxes and place them correspondingly with the label boxes;
6. Click and drag ListView control and select details in view in the property of
ListView control; click and drag button and change the text to ADD in the property
of button.
7. Double-click on the form and give the codings. Similarly, double-click on the button
and give the codings.
8. Save the program.
9. Run the program.
10. End the program.

25
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

FORM DESIGN:

PROPERTIES:

CONTROLS TEXT NAME

Label1 Roll no Label1


Label2 Name Label2
Label3 Tamil Label3
Label4 English Label4
Label5 Maths Label5
Label6 Computer Science Label6
Label7 Physics Label7
Label8 Chemistry Label8
Label9 DISPLAY STUDENT’S Label9
MARKSHEET USING
LISTVIEW CONTROL
TextBox1 - TextBox1
TextBox2 - TextBox2
TextBox3 - TextBox3
TextBox4 - TextBox4
TextBox5 - TextBox5
TextBox6 - TextBox6
TextBox7 - TextBox7
TextBox8 - TextBox8
Button Add Button
ListView - ListView

26
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

SOURCE CODE:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
ListView1.Columns.Add("roll", 60, HorizontalAlignment.Left)
ListView1.Columns.Add("name", 100, HorizontalAlignment.Left)
ListView1.Columns.Add("tam", 60, HorizontalAlignment.Center)
ListView1.Columns.Add("eng", 60, HorizontalAlignment.Center)
ListView1.Columns.Add("maths", 60, HorizontalAlignment.Center)
ListView1.Columns.Add("cs", 60, HorizontalAlignment.Center)
ListView1.Columns.Add("phy", 60, HorizontalAlignment.Center)
ListView1.Columns.Add("chem", 60, HorizontalAlignment.Center)
ListView1.Columns.Add("total", 60, HorizontalAlignment.Center)
ListView1.Columns.Add("ave", 60, HorizontalAlignment.Center)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim newitem As New ListViewItem(TextBox1.Text)
Dim tot, ave As Single
newitem.SubItems.Add(TextBox2.Text)
newitem.SubItems.Add(TextBox3.Text)
newitem.SubItems.Add(TextBox4.Text)
newitem.SubItems.Add(TextBox5.Text)
newitem.SubItems.Add(TextBox6.Text)
newitem.SubItems.Add(TextBox7.Text)
newitem.SubItems.Add(TextBox8.Text)
ListView1.Items.Add(newitem)
tot = (Val(TextBox3.Text) + Val(TextBox4.Text) + Val(TextBox5.Text) +
Val(TextBox6.Text) + Val(TextBox7.Text) + Val(TextBox8.Text))
ave = tot / 6
newitem.SubItems.Add(tot)
newitem.SubItems.Add(ave)
TextBox1.Text = " "
TextBox2.Text = " "
TextBox3.Text = " "
TextBox4.Text = " "
TextBox5.Text = " "
TextBox6.Text = " "
TextBox7.Text = " "
TextBox8.Text = " "
MessageBox.Show("Record inserted successfully")
End Sub
End Class

27
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

OUTPUT:

RESULT:
Thus the program has been successfully executed.

28
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

EX.NO:7
SIMPLE LOGIN FORM WITHOUT
DATE: DATABASE

AIM:

To write a VB.NET program to find the simple login form without database
using Windows Form Application.

ALGORITHM:
1. Start the program.
2. Open Microsoft visual studio 2008.
3. Go to file ->new project ->visual basic->windows->windows form application.
4. Design the page with the required tools. (label,button,textbox)
5. Change the properties for the selected tools. Rename the label as user name and
another label as password. and then rename the buttons as Login and Exit.
6. Click Password Textbox ->property-> passwordchar - *.
7. Create Form 2 and design the page with label as “DONE”.
8. Select the label in the form 2 design page and write code accordingly.
9. Select the login button in form 1 design page and write code accordingly.
10. Save & run the program.
11. Stop the program

29
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

FORM DESIGN:

PROPERTIES:

CONTROLS TEXT NAME

FORM1

Label1 LOGIN PAGE Label1

Label2 Username Label2

Label3 Password Label3

Textbox1 - Textbox1

Textbox2 - Textbox2

Button1 Login Button1

Button2 Exit Button2

FORM 2

Label1 Done! Label1

30
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

SOURCE CODE:
Form1:

PublicClass Form1
PrivateSub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
Me.Dispose()
EndSub
PrivateSub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
If TextBox1.Text = "Anu"And TextBox2.Text =
"1333"Then Form2.Show()
Me.Hide()
EndIf
EndSub
EndClass

Form2:
PublicClass Form2
PrivateSub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Label1.Click
Label1.Text = "DONE!"
EndSub
EndClass

31
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

OUTPUT:

RESULT:
Thus the program has been successfully executed.

32
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

EX.NO:8
AUTOMATIC COMPUTE AGE USING
DATE:
DATETIMEPICKER

AIM:

To write a VB.NET program to find the automatic compute age using datatimepicker
in Windows Form Application.

ALGORITHM:

1. Start visual studio 2008.


2. Go to file<<new<<project<<visual basic<<window<<windows form application
3. Place a label box and named it as calculating the age.
4. Place two label boxes and named it as our wish.
5. The datetimepicker tool is place at the form
6. Text box is also placed.
7. Go to the properties of the textbox and in the ENABLED column select the false
option
8. Double clock on the datetimepicker tool and write the coding’s
9. Save the program
10. Run the program
11. End the program

33
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

FORM DESIGN:

PROPERTIES:

CONTROLS TEXT NAME

Label 1 CALCULATE OUR AGE Label 1

Label 2 Select Your Date Label 2

Label 3 Your Age Label 3

Datetimepicker 1 - Datetimepicker 1

Textbox 1 - Textbox 1

34
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

SOURCE CODE:
PublicClass Form1
PrivateSub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles DateTimePicker1.ValueChanged
Dim datecheck AsString
Dim today As System.DateTime = System.DateTime.Now
datecheck = DateTimePicker1.Text
Dim yearnow AsInteger = today.Year
Dim yeardtp AsInteger = DateTimePicker1.Value.Year
Dim rightyear AsInteger = DateTimePicker1.Value.Year
Dim minimage AsInteger = yeardtp - rightyear
Dim currentage AsInteger = yearnow - yeardtp
TextBox1.Text = currentage.ToString
TextBox1.Show()
EndSub

35
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

OUTPUT:

RESULT:
Thus the program has been successfully executed.

36
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

EX.NO:9
DATE: ERROR HANDLING

AIM:

To write a VB.NET program to find the Error Handling using Windows Form
Application.

ALGORITHM:

1. Start the program.

2. Open Microsoft visual studio 2008.

3. Go to file->new project->visual basic->windows->windows form application.

4. Design the page with the required tools. (Label box, button, textbox)

5. Change the properties for the selected tools.

6. Select the tools used in the design page and write code accordingly.

7. Save and Run the program.

8. Stop the program.

37
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

FORM DESIGN:

PROPERTIES:

CONTROLS TEXT NAME

Label1 ERROR HANDLING Label1

Label2 Enter the number under 250 Label2

Textbox1 - Textbox1

Button1 CHECK Button1

38
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

SOURCE CODE:
Public Class Form1
Private Sub cmdCheck_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdCheck.Click
Dim intInteger As Byte
Try
intInteger = CByte(TextBox1.Text)
Catch ex As InvalidCastException
MsgBox("There was an Invalid Cast Exception error")
Catch ex As OverflowException
MsgBox("There was an Overflow Exception error")
Catch ex As Exception
MsgBox("There was a general error")
End Try
MsgBox("You entered : " & intInteger.ToString)
End Sub
End Class

39
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

OUTPUT:

RESULT:
Thus the program has been successfully executed.

40
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

EX.NO:10
GOOGLE MAP
DATE:

AIM:

To create a google map using visual studio 2008.

ALGORITHM:

1. Start the visual studio 2008


2. Go to file<<new<<project<<c#<<windows form application.
3. The split container is placed in the specified area
4. Now in the new window place the label box named as country, state, city, street.
5. Place four text box in parallel to the label box.
6. Button is place in the center of the left page
7. Now save the file as we required
8. Run the program
9. End the program

41
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

FORM DESIGN:

PROPERTIES:

CONTROLS TEXT NAME


splitcontainer 1 - Splitcontainer 1

Label 1 GOOGLE MAP Label 1

Label 2 Street Label 2

Label 3 City Label 3

Label 4 State Label 4

Label 5 Zip Label 5


Textbox1-textbox4 - Textbox1-textbox4

Web browser1 - Web browser 1

Button 1 Search Button 1

42
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

SOURCE CODE:

PublicClass Form1

PrivateSub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles DateTimePicker1.ValueChanged

Dim datecheck AsString


Dim today As System.DateTime = System.DateTime.Now
datecheck = DateTimePicker1.Text
Dim yearnow AsInteger = today.Year
Dim yeardtp AsInteger = DateTimePicker1.Value.Year
Dim rightyear AsInteger = DateTimePicker1.Value.Year
Dim minimage AsInteger = yeardtp - rightyear
Dim currentage AsInteger = yearnow - yeardtp
TextBox1.Text = currentage.ToString
TextBox1.Show()
EndSub
PrivateSub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
HandlesMyBase.Load
EndSub
EndClass

43
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

OUTPUT:

RESULT:
Thus the program has been successfully executed.

44
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

EX.NO:11 INSERT, DELETE AND UPDATE THE DATA


IN DATAGRIDVIEW WITHOUT USING
DATE: DATABASE

AIM:

To insert, delete and update the data in DataGrid View without using Database.

ALGORITHM:

1. Open Microsoft visual studio 2008


2. Click file>>select new >>new project>>c#>>windows form application
3. In the form drag and drop Label box, Text Box, Button, and DataGridView
control from the Toolbox.
4. Click the label and rename it, which is replaced by the column name in the
DataGridView.
5. Click the buttons and give the coding.
6. Save the program
7. Run the program.
8. End the program.

45
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

FORM DESIGN:

46
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

PROPERTIES:

CONTROLS TEXT NAME

Label1 Name Label1

Label2 Address Label2

Label3 Mobile number Label3

Label4 Pin code Label4

Label5 SHOPPING DETAILS USING Label5


DATAGRID
Textbox1 - Textbox1

Textbox2 - Textbox2

Textbox3 - Textbox3

Button1 Insert Button1

Button2 New Button2

Button3 Update Button3

Button4 Delete Button4

47
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

SOURCE CODE:
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 shopping_online
{
public partial class Form1 : Form
{
DataTable table = new DataTable("table");
int index;
public Form1()
{
InitializeComponent();
}
private void form1_Load(object sender, EventArgs e)
{
table.Columns.Add("NAME", Type.GetType("System.String"));
table.Columns.Add("ADDRESS", Type.GetType("System.String"));
table.Columns.Add("MOBILE NO", Type.GetType("System.Double"));
table.Columns.Add("PINCODE", Type.GetType("System.Double"));
dataGridView1.DataSource = table;
}

private void button1_Click(object sender, EventArgs e)


{
table.Rows.Add(textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text);
MessageBox.Show("Data Inserted Successfully");
}

private void button2_Click(object sender, EventArgs e)


{
textBox1.Text = String.Empty;
textBox2.Text = String.Empty;
textBox3.Text = String.Empty;
textBox4.Text = String.Empty;
}
private void dataGridview1_CellClick(object sender, DataGridViewCellEventArgs e)
{
index = e.RowIndex;
DataGridViewRow row = dataGridView1.Rows[index];
textBox1.Text = row.Cells[0].Value.ToString();
textBox2.Text = row.Cells[1].Value.ToString();

48
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

textBox3.Text = row.Cells[2].Value.ToString();
textBox4.Text = row.Cells[3].Value.ToString();
}

private void button3_Click(object sender, EventArgs e)


{
DataGridViewRow newdata=dataGridView1.Rows[index];
newdata.Cells[0].Value = textBox1.Text;
newdata.Cells[1].Value = textBox2.Text;
newdata.Cells[2].Value = textBox3.Text;
newdata.Cells[3].Value = textBox4.Text;
MessageBox.Show("Data Updated Successfully");
}
private void button4_Click(object sender, EventArgs e)
{
index = dataGridView1.CurrentCell.RowIndex;
dataGridView1.Rows.RemoveAt(index);
MessageBox.Show("Data Deleted Successfully");
}
}

49
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

OUTPUT:

RESULT:
Thus the program has been successfully executed.

50
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

EX.NO:12
DISPLAY THE TWEETS USING
DATE: DATAGRIDVIEW WITH MS-ACCESS

AIM:

To display the TWEETS using DataGridView with MS access in ASP.NET web

application.

ALGORITHM:

1. Start the program

2. Open file→ New project, visual c# →add ASP.NET web application template and

name the project

3. Default page of aspx design tab add gridview &amp; sql datasource.

4. Open MS access and create an database and save the database as TWEETL

5. Create the design view for the table and the data type and save as at access 2000

Database.

6. Open visual studio→using server explorer add data connection→Browse the file

name and add it →check the test connection.

7. Through sqlDatasource →configure data source→connect the databse with new

connection to check the TEST QUERY.

8. Using gridview choose the data source→SqlDataSource and Enable it.Through

auto format we can select the scheme.

9. Solution Explorer→add the existing item of the database were saved

10. Run the program using google chrome.

51
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

FORM DESIGN:

52
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

53
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

PROPERTIES:

CONTROLS TEXT NAME

Gridview - Gridview1

SqlDataSourse - SqlDataSourse1

54
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

OUTPUT:

RESULT:
Thus the program has been successfully executed.

55
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

EX.NO:13
DATE: QUERYSTRING

AIM:

To write a ASP.NET program to create the querystring collection using Web


Application.

ALGORITHM:

1. Open Microsoft visual studio 2008.


2. Open file>>New project>>visual c#>>add ASP.NET web application template
and name the project.
3. Create page1 and Label,Textbox,Button from the tool box.
4. Again, create page2 and drop a Label from the tool box.
5. Click the buttons and the codings.
6. In output, page1 we have to right click>>view in browser.
7. Form will be created in next page.
8. Save the program.
9. Run the program.

56
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

FROM DESIGN:

Page1:

PROPERTIES:

CONTROLS TEXT NAME

Label 1 Firstname Label 1

Label 2 Lastname Label 2

Textbox 1 - Textbox 1

Textbox 2 - Textbox 2

Button 1 QUERYSTRING Button 1

57
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

SOURCE CODE:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace q1
{
public partial class page1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Redirect("page2.aspx?firstname=" + TextBox1.Text +
"&lastname=" + TextBox2.Text + "");
}
}
}

58
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

Page2:

PROPERTIES:

CONTROLS TEXT NAME

Label 1 Fullname Label 1

Lable 2 Lblname Label 2

59
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

SOURCE CODE:
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace q1
{
public partial class page2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
lblname.Text = Request.QueryString["firstname"] +
Request.QueryString["lastname"];
}
}
}

60
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

OUTPUT:
Page1:

Page2:

RESULT:
Thus the program has been successfully executed.

61
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

EX.NO:14
DATE: ADROTATOR CONTROL

AIM:

To write a ASP.NET program using ADRotator control.

ALGORITHM:

1. Open Microsoft Visual Studio –> click file New Website, to click a new
empty web application / website.
2. Create New web page for display and click Website Add new item, to select
XML file.
3. Right click on Solution Explorer –> Add New folder and rename(images) right click
to select Add existing item and select jpg files to copy and paste it.
4. Add New XML File in project for write advertisement detail.
5. Then click website to add new item to select Web form.
6. Drag and drop AdRotator Control on web page from toolbox.
7. Assign XML File to AdvertisementFile property of AdRotator control.
8. Then save it and start debugging.

62
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

FORM DESIGN:

PROPERTIES:

CONTROL ADVERTISEMENT NAME

ADRotator XML file ADRotator

63
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

SOURCE CODE:
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageUrl>Images\flower1.jpg</ImageUrl>
<NavigatorUrl>http://www.flower1.com</NavigatorUrl>
<width>600</width>
<height>300</height>
<Impression>800</Impression>
</Ad>
<Ad>
<ImageUrl>Images\flower2.jpg</ImageUrl>
<NavigatorUrl>http://www.flower2.com</NavigatorUrl>
<width>600</width>
<height>300</height>
<Impression>800</Impression>
</Ad>
</Advertisements>

64
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

OUTPUT:

RESULT:

Thus the program has been successfully executed.

65
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

EX.NO:15
IMAGE SLIDER
DATE:

AIM:

To write a ASP.NET program to create the image slider in using web application.

ALGORITHM:

1. Start the program.


2. Open Microsoft visual studio 2008.
3. Go to file -> new project-> other language -> c#-> web-> ASP.NET web application.
4. Copy the image from the file explorer place it within the project file.
5. Design the page with the required tools.
6. Change the properties for the selected tools.
7. Select the tools used in the design page and write code accordingly.
8. Save and run the program.
9. Stop the program.

66
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

FROM DESIGN:

PROPERTIES:

CONTROLS TEXT NAME

Image 1 - Image 1

Image 2 - Image 2

Image 3 - Image 3

Button 1 - Button 1

Button 2 - Button 2

67
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

SOURCE CODE:
Using System.Configuration;
Using System.Data;
Using System.Linq;

Using System.Web;
Using System.Web.Security;
Using System.Web.UI;
Using System.Web.UI.HtmlControls;
Using System.Web.UI.WebControls;
Using System.Web.UI.WebControls.WebParts;
Using System.Xml.Linq;
Namespace WebApplication1

Public partial class _Default: System.Web.UI.Page


{

Protected void Button1_Click (object sender, EventArgs e)

String url = Image1.ImageUrl;


Image1.ImageUrl = Image2.ImageUrl;
Image2.ImageUrl = Image3.ImageUrl;
Image3.ImageUrl = url; }
protected void Button2_Click(object sender, EventArgs e)

{string url = Image3.ImageUrl;


Image3.ImageUrl = Image2.ImageUrl;
Image2.ImageUrl = Image1.ImageUrl;
Image1.ImageUrl = url;
}

}
}

68
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

OUTPUT:

RESULT:
Thus the program has been successfully executed.

69
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

EX.NO:16 REGISTRATION FORM VALIDATION

DATE:

AIM:
To write a ASP.NET program to create the registration from with validation using web
application.

ALGORITHAM:

1. Start the program.


2. Open Microsoft visual studio 2008.
3. Go to file->new project->other language->c#->web ->ASP.NET web application.
4. Design the page with the required tools.
5. Drag the validation tool in the design page.
6. Change the properties for the selected tools.
7. Select the tools used in the design page and write code accordingly.
8. Save the program.
9. Run the program.
10. End the program.

70
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

FORM DESIGN:

71
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

72
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

PROPERTIES:

CONTROLS TEXT NAME FIELD VALIDATOR

Label 1 LOGIN FROM Label 1 -


VALIDATION

Label 2 User name Label 2 Required field validator

Label 3 e-mail Label 3 Regular expression validator

Label 4 Password Label 4 Required field validator

Label 5 Conform password Label 5 Required field validator&


compare validator

Label 6 Country Label 6 Required validator

Textbox 1 - Textbox 1 -

Textbox 2 - Textbox 2 -

Text box 3 - Textbox 3 -

Textbox 4 - Textbox 4 -

Dropdown box 1 - Dropdown box 1 -

Button 1 Submit Button 1 -

73
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

SOURCE CODE:
Using.system;

Using system.collections;

Using system.configarations;

Using system.data;

Using system.ling;

Using system.web;

Using system.web.security;

Using system.web.UI;

Using system.web.UI.HTML controls;

Using system.web.UI.webcontrols;

Using system.web.UI.webcontrols.webparts;

Using system.xml.ling;

Name space webapplication7

Public partial class_default:system.web.UI.page

Protected void button1_click (object sender,eventargs e)

response.write(“LOGIN SUCCESFULLY”);

74
DEPARTMENT OF COMPUTER SCIENCE, SACWC WEB TECHNOLOGY LAB

OUTPUT:

RESULT:
Thus the program has been successfully executed.

75

You might also like