SHREE UTTAR GUJARAT BCA COLLEGE
NAME :- GAJERA HET N. CLASS:- TYBCA
ROLL NO :- 81 SUBJECT :- [Link]
INDEX
Page
No. Program Name No Sign
1 Design a Registration form [Link] page with fields Username,
choose password, confirm password, age, email id, mobileno and a
submit button.
Use:
a) RequiredFieldValidator - for Username
b) CompareValidator - for Confirm password field.
c) RangeValidator - for Age field. d)
d) RegularExpressionValidator - for Email field.
e) CustomValidator - for mobile no field.
2 Write a program to perform to design a simple calculator to perform
addition, subtraction, multiplication and division.
3 Design a user interface to print the result student with total marks and
percentage.
4 Write a program Day of the Date.
5
Create a Database “DbStudent”. Create following table. tbl_student
(stud_id, stud_rollno, stud_name, stud_class, stud_department)
• Write a simple program to demonstrate Insertion of data into
database.
• Write a program to show recodes in GridView Control.
• Write a program to print the Student Name and Student Class
based on the Student Department (Search Functionality).
• Write a program to update student record.
• Write a program to delete particular student record.
1. Design a Registration form [Link] page with fields Username, choose password,
confirm password, age, email id, mobileno and a submit button.
[Link]
Use:
f) RequiredFieldValidator - for Username
g) CompareValidator - for Confirm password field.
h) RangeValidator - for Age field. d)
i) RegularExpressionValidator - for Email field.
j) CustomValidator - for mobile no field.
[Link]
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="[Link]"
Inherits="validationEx" %>
<!DOCTYPE html>
<html xmlns="[Link]
<head runat="server">
<title></title>
<style
type="text/css">
.auto-style1 {
width: 62%;
}
.auto-style2 {
width: 124px;
}
.auto-style3 {
width: 21px;
}
.auto-style5 {
width: 124px;
height: 42px;
}
.auto-style6 {
width: 21px;
height: 42px;
}
.auto-style7 {
width: 140px;
}
.auto-style8 {
width: 140px;
height: 42px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style1">
<tr>
<td colspan="4" style="text-align: center">Registration Form</td>
</tr>
<tr>
<td class="auto-style2">Name</td>
<td class="auto-style3">:</td>
<td class="auto-style7">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
Page 1
[Link]
</td>
<td class="auto-style5">
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server" ControlToValidate="TextBox1" ErrorMessage="Please Enter
Name"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style2">Email</td>
<td class="auto-style3">:</td>
<td class="auto-style7">
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</td>
<td class="auto-style5">
<asp:RegularExpressionValidator
ID="RegularExpressionValidator1" runat="server" ControlToValidate="TextBox3"
ErrorMessage="Please Enter Email Properly"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-
.]\w+)*"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="auto-style2">Password</td>
<td class="auto-style3">:</td>
<td class="auto-style7">
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
</td>
<td class="auto-style5"> </td>
</tr>
<tr>
<td class="auto-style5">Confirm Password</td>
<td class="auto-style6">:</td>
<td class="auto-style8">
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
</td>
<td class="auto-style5">
<asp:CompareValidator ID="CompareValidator1" runat="server"
ControlToCompare="TextBox4" ControlToValidate="TextBox5" ErrorMessage="Password
and
Confirm Password must be same"></asp:CompareValidator>
</td>
</tr>
<tr>
<td class="auto-style2">Age</td>
<td class="auto-style3">:</td>
<td class="auto-style7">
<asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
</td>
<td class="auto-style5">
<asp:RangeValidator ID="RangeValidator1" runat="server"
ControlToValidate="TextBox6" ErrorMessage="Age must Be 20 - 40."
MaximumValue="40"
MinimumValue="20"></asp:RangeValidator>
</td>
</tr>
<tr>
<td class="auto-style2">Mobile No</td>
Page 2
[Link]
<td class="auto-style3">:</td>
<td class="auto-style7">
<asp:TextBox ID="TextBox7" runat="server"
TextMode="Number"></asp:TextBox>
</td>
<td class="auto-style5">
<asp:CustomValidator ID="CustomValidator1" runat="server"
ControlToValidate="TextBox7" ErrorMessage="Enter only 10 digit mobile number"
SetFocusOnError="True"></asp:CustomValidator>
</td>
</tr>
<tr>
<td class="auto-style2">
</td>
<td class="auto-style3">
<asp:Button ID="Button1" runat="server" Text="Register" />
</td>
<td class="auto-style7"> </td>
<td class="auto-style5"> </td>
</tr>
</table>
</div>
</form>
</body>
</html>
Page 3
[Link]
2. Write a program to perform to design a simple calculator to perform addition, subtraction,
multiplication and division.
[Link]
Partial Class _Default
Inherits [Link]
Protected Sub btnAdd_Click(sender As Object, e As EventArgs) Handles
[Link]
Dim Sum As Integer
Dim a As Integer
Dim b As Integer a
= Val([Link])
b = Val([Link])
Sum = (a + b)
[Link] = Sum
End Sub
Protected Sub btnSubtract_Click(sender As Object, e As EventArgs) Handles
[Link]
Dim subno As Integer
Dim a,b As Integer a
= Val([Link])
b = Val([Link])
subno = (a - b)
[Link]() = subno
End Sub
Protected Sub btnDivide_Click(sender As Object, e As EventArgs) Handles
[Link]
Dim divno As
Integer Dim a,b As
Integer a =
Val([Link])
b = Val([Link])
divno = (a / b)
[Link] = divno
End Sub
Protected Sub btnMultiply_Click(sender As Object, e As EventArgs)
Handles [Link] Dim mul As Integer
Dim a As Integer
Dim b As Integer a
= Val([Link])
b = Val([Link])
mul = (a * b)
[Link] = mul
End Sub
Page 4
[Link]
End Class
Page 5
[Link]
3. Design a user interface to print the result student with total marks and percentage.
Subject 1
Subject 2
Subject 3
Total Marks
Percantage Calculate
Clear
Division
[Link]
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="[Link]"
Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="[Link]
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<center>
<div>
<asp:Label ID="Label1" runat="server" Font-Size="20pt"
Text="Q-2 Markes in percentage calculate"></asp:Label>
<br />
<br />
<br />
<br /> SUBJECT
1 :
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br /> SUBJECT
2 :
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<br /> SUBJECT
3 :
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="total" runat="server" Height="40px"
Text="Calculate" Width="80px" />
<asp:Button ID="btnClear" runat="server" Height="40px"
Text="CLEAR" Width="80px" />
Page 6
[Link]
<asp:Button ID="btnExit" runat="server" Height="40px"
Text="Exit" Width="80px" />
<br />
<br /> TOTAL OF
MARKS : <asp:TextBox
ID="TextBox4"
runat="server"></asp:TextBox>
<br /> <br /> PERCENTAGE :
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
</div>
</center>
</form>
</body>
</html>
[Link]
Partial Class _Default
Inherits [Link]
Protected Sub total_Click(sender As Object, e As EventArgs) Handles
[Link]
Dim Sum As Integer
Dim a As Integer
Dim b As Integer
Dim c As Integer a
= Val([Link])
b = Val([Link])
c = Val([Link])
Sum = (a + b + c) / 3
[Link] = a + b + c
[Link]= Sum
End Sub
Protected Sub btnClear_Click(sender As Object, e As EventArgs) Handles
[Link]
[Link] = [Link]
[Link] = [Link]
[Link] = [Link]
[Link] = [Link]
[Link] = [Link]
End Sub
Protected Sub btnExit_Click(sender As Object, e As EventArgs) Handles
[Link] [Link](0)
End Sub
End Class
Output
Page 7
[Link]
Page 8
[Link]
4. Write a program Day of the Date.
[Link]
Partial Class _Default
Inherits [Link]
Protected Sub btnDisplay_Click(sender As Object, e As EventArgs) Handles
[Link]
Dim dateValue As Date
dateValue = [Link]
[Link] =WeekdayName(Weekday(DateValue))
End Sub
End Class
Output
Page 9
[Link]
5. Create a Database “DbStudent”. Create following table. tbl_student (stud_id, stud_rollno,
stud_name, stud_class, stud_department)
• Write a simple program to demonstrate Insertion of data into database.
• Write a program to show recodes in GridView Control.
• Write a program to print the Student Name and Student Class based on the Student
Department (Search Functionality).
• Write a program to update student record.
• Write a program to delete particular student record.
[Link]
<%@ Page Language="VB" AutoEventWireup="false"
CodeFile="[Link]" Inherits="_Default" %>
<!DOCTYPE
html>
<html xmlns="[Link]
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Student id:<asp:TextBox ID="txtid"
runat="server"></asp:TextBox>
<br />
<br />
student name:<asp:TextBox ID="txtname" runat="server"></asp:TextBox>
 
;
<br /><br />
student class<asp:TextBox ID="txtclass"
runat="server"></asp:TextBox>
<br /><br /><br /><br /><br />
<asp:GridView ID="GridView1"
runat="server">
</asp:GridView>
<br /><br />
<asp:Button ID="btninsert" runat="server" Text="insert"
/> &nb sp;
<asp:Button ID="btnupdate" runat="server" Text="update"
/> &nb
sp;
<asp:Button ID="btndelete" runat="server" Text="delete"
/>
</div>
Page 10
[Link]
</form>
</body>
</html>
[Link]
Imports [Link]
Imports [Link]
Partial Class _Default
Inherits [Link]
Dim con As New SqlConnection("DataSource=(LocalDB)\
v11.0;AttachDbFilename= D:\asp assignment\8\App_Data\[Link];Integrated
Security=True")
Protected Sub btninsert_Click(sender As Object, e As EventArgs)
Handles [Link]
Dim sid As Integer = [Link] Dim sname
As String = [Link]
Dim sclass As String = [Link] [Link]()
Dim command As New SqlCommand("insert into stud values('" & sid &
"','"
& sname & "','" & sclass & "')", con)
[Link]()
MsgBox("record inserted")
[Link]()
list()
End Sub
Private Sub list()
Dim command As New SqlCommand("select * from stud", con)
Dim sd As New SqlDataAdapter(command) Dim dt As
New DataTable
[Link](dt)
[Link] = dt
[Link]()
End Sub
Protected Sub btnupdate_Click(sender As Object, e As EventArgs)
Handles [Link]
Dim sid As Integer = [Link] Dim sname
As String = [Link]
Dim sclass As String = [Link] [Link]()
Dim command As New SqlCommand("update stud set id='" & sid &
"',class='"
& sclass & "' where name='" & sname & "'",
con) [Link]()
MsgBox("update suceesfully")
[Link]() list()
End Sub
Page 11
[Link]
Protected Sub btndelete_Click(sender As Object, e As EventArgs)
Handles [Link]
Dim sid As Integer = [Link]
[Link]()
Dim command As New SqlCommand("delete stud where id='" & sid &
"'", con) [Link]() MsgBox("record deleted")
[Link]() list()
End Sub
Protected Sub Page_Load(ByVal sender As
Object, ByVal e As [Link]) Handles [Link]
list() list()
End Sub
End class
Output
Page 12