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

1.money Conversion

The document contains source code for 8 different programs written in Visual Basic .NET with the following functions: 1. A currency conversion program that converts between Rupees, Dollars, Euros, and Canadian Dollars. 2. A basic calculator program with memory and recall functions. 3. A program that converts text between uppercase and lowercase. 4. A program that solves quadratic equations. 5. A program that calculates the factorial of a given number. 6. A program that determines if a character is a vowel or not. 7. A basic calendar program that displays the day, date, month, and year from a date picker. 8. A

Uploaded by

Keerthana R
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
77 views

1.money Conversion

The document contains source code for 8 different programs written in Visual Basic .NET with the following functions: 1. A currency conversion program that converts between Rupees, Dollars, Euros, and Canadian Dollars. 2. A basic calculator program with memory and recall functions. 3. A program that converts text between uppercase and lowercase. 4. A program that solves quadratic equations. 5. A program that calculates the factorial of a given number. 6. A program that determines if a character is a vowel or not. 7. A basic calendar program that displays the day, date, month, and year from a date picker. 8. A

Uploaded by

Keerthana R
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 64

1.

MONEY CONVERSION

-SOURCE CODE:

Public Class Form1


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If ComboBox1.Text = "Rupees" Then
Select Case ComboBox2.SelectedItem
Case "Dollars"
TextBox1.Text = TextBox2.Text / 74.18
Case "Canadian Dollars"
TextBox1.Text = TextBox2.Text / 58.96
Case "Euros"
TextBox1.Text = TextBox2.Text / 87.39
Case "Rupees"
TextBox1.Text = "INVALID CONVERSION"
End Select
ElseIf ComboBox1.Text = "Dollars" Then
Select Case ComboBox2.SelectedItem
Case "Rupees"
TextBox1.Text = TextBox2.Text * 74.18
Case "Canadian Dollars"
TextBox1.Text = TextBox2.Text / 0.8
Case "Euros"
TextBox1.Text = TextBox2.Text / 1.18
Case "Dollars"
TextBox1.Text = "INVALID CONVERSION"
End Select
ElseIf ComboBox1.text = "Euros" Then
Select Case ComboBox2.SelectedItem
Case "Dollars"
TextBox1.Text = TextBox2.Text * 1.18
Case "Canadian Dollars"
TextBox1.Text = TextBox2.Text * 1.46
Case "Rupees"
TextBox1.Text = TextBox2.Text * 87.39
Case "Euros"
TextBox1.Text = "INVALID CONVERSION"
End Select
ElseIf ComboBox1.text = "Canadian Dollars" Then
Select Case ComboBox2.SelectedItem
Case "Dollars"
TextBox1.Text = TextBox2.Text * 0.8
Case "Euros"
TextBox1.Text = TextBox2.Text / 1.46
Case "Rupees"
TextBox1.Text = TextBox2.Text * 58.96
Case "Canadian Dollars"
TextBox1.Text = "INVALID CONVERSION"
End Select
End If
End Sub
End Class
-OUTPUT:
2.CALCULATOR WITH MEMORY AND RECALL OPERATION

-SOURCE CODE:

Public Class Form1


Dim x As Integer
Dim a As Integer
Dim b As Integer
Dim c As Integer
Dim d As Integer

Dim o As Char
Private Sub ButtonClear_Click(sender As Object, e As EventArgs) Handles ButtonClear.Click
TextBox1.Clear()
End Sub

Private Sub ButtonMemory_Click(sender As Object, e As EventArgs) Handles ButtonMemory.Click


x = TextBox1.Text
TextBox1.Clear()
End Sub

Private Sub ButtonRecall_Click(sender As Object, e As EventArgs) Handles ButtonRecall.Click


TextBox1.Text = x
End Sub

Private Sub Button0_Click(sender As Object, e As EventArgs) Handles Button0.Click


TextBox1.AppendText("0")
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


TextBox1.AppendText("1")
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


TextBox1.AppendText("2")
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click


TextBox1.AppendText("3")
End Sub

Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click


TextBox1.AppendText("4")
End Sub

Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click


TextBox1.AppendText("5")
End Sub

Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click


TextBox1.AppendText("6")
End Sub
Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
TextBox1.AppendText("7")
End Sub

Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click


TextBox1.AppendText("8")
End Sub

Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click


TextBox1.AppendText("9")
End Sub

Private Sub ButtonPlus_Click(sender As Object, e As EventArgs) Handles ButtonPlus.Click


a = Val(TextBox1.Text)
o = "+"
TextBox1.Clear()
End Sub

Private Sub ButtonMinus_Click(sender As Object, e As EventArgs) Handles ButtonMinus.Click


b = Val(TextBox1.Text)
o = "-"
TextBox1.Clear()
End Sub

Private Sub ButtonDiv_Click(sender As Object, e As EventArgs) Handles ButtonDiv.Click


c= Val(TextBox1.Text)
o = "/"
TextBox1.Clear()
End Sub

Private Sub ButtonMult_Click(sender As Object, e As EventArgs) Handles ButtonMult.Click


d = Val(TextBox1.Text)
o = "*"
TextBox1.Clear()
End Sub

Private Sub ButtonEquals_Click(sender As Object, e As EventArgs) Handles ButtonEquals.Click


Select Case o
Case "+"
TextBox1.Text = a + Val(TextBox1.Text)
Case "-"
TextBox1.Text = b - Val(TextBox1.Text)
Case "/"
TextBox1.Text = c / Val(TextBox1.Text)
Case "*"
TextBox1.Text = d * Val(TextBox1.Text)
End Select
End Sub
End Class
OUTPUT:
3.CASE CONVERSION

SOURCE CODE:

Public Class Form1


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim str As String
Dim c As Char
Dim i As Integer

str = TextBox1.Text

For i = 0 To str.Length - 1
c = str(i)
If (Char.IsUpper(c)) Then
TextBox2.Text = TextBox2.Text + Char.ToLower(c)
Else
TextBox2.Text = TextBox2.Text + Char.ToUpper(c)
End If
Next i
End Sub
End Class
-OUTPUT:
4.QUADRATIC EQUATION

-SOURCE CODE:

Imports System.Console
Imports System.Math

Public Class Form1


Public a, b, c, det, r1, r2 As Single
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Texta.Text = ""
Textb.Text = ""
Textc.Text = ""
Textr1.Text = ""
Textr2.Text = ""
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


Textr1.Text = ""
Textr2.Text = ""
If Texta.Text = "0" Then
MsgBox("Cofficient a must not be 0 !!!")
Texta.Text = ""
Texta.Focus()
ElseIf Texta.Text = "" Or IsNothing(Texta.Text) Or IsNumeric(Texta.Text) = False Then
MsgBox("Cofficient a must have an numeric value !!!")
Texta.Text = ""
Texta.Focus()
ElseIf Textb.Text = "" Or IsNothing(Textb.Text) Or IsNumeric(Textb.Text) = False Then
MsgBox("Cofficient b must have an nuberic value !!!")
Textb.Text = ""
Textb.Focus()
ElseIf Textc.Text = "" Or IsNothing(Textc.Text) Or IsNumeric(Textc.Text) = False Then
MsgBox("Cofficient a must have an numeric value !!!")
Textc.Text = ""
Textc.Focus()
Else
a = Val(Texta.Text)
b = Val(Textb.Text)
c = Val(Textc.Text)
det = (b * b) - (4 * a * c)
If (det > 0) Then
r1 = (-b + Sqrt(det)) / (2 * a)
r2 = (-b - Sqrt(det)) / (2 * a)
result.Text = "There are two roots :: "
Textr1.Enabled = True
Textr2.Enabled = True
Textr1.Text = r1
Textr2.Text = r2
ElseIf (det = 0) Then
r1 = (-b + Sqrt(det)) / (2 * a)
result.Text = "There is only one root :: "
Textr1.Enabled = True
Textr1.Text = r1
Else
result.Text = "There is no root !!!"

End If
End If
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


Texta.Text = ""
Textb.Text = ""
Textc.Text = ""
Textr1.Text = ""
Textr2.Text = ""
result.Text = ""
Textr1.Enabled = False
Textr2.Enabled = False
Texta.Focus()
End Sub

Private Sub Texta_GotFocus(sender As Object, e As EventArgs) Handles Texta.GotFocus


Texta.SelectAll()
End Sub

Private Sub Textb_GotFocus(sender As Object, e As EventArgs) Handles Textb.GotFocus


Textb.SelectAll()
End Sub

Private Sub Textc_GotFocus(sender As Object, e As EventArgs) Handles Textc.GotFocus


Textc.SelectAll()
End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click


Application.Exit()
End Sub
End Class
-OUTPUT:
5.FACTORIAL OF A NUMBER

-SOURCE CODE:

Public Class Form1


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim n As Double
Dim i As Integer
Dim fact As Integer
fact = 1
n = Val(TextBox1.Text)

For i = 1 To n
fact = fact * i
Next

TextBox2.Text = fact
End Sub
End Class
-OUTPUT:
6.VOWEL OR NOT A VOWEL

-SOURCE CODE:

Public Class Form1


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim c As Char
c = UCase(TextBox1.Text)
If c = "A" Or c = "E" Or c = "I" Or c = "O" Or c = "U" Then
Label3.Text = "Vowel"
Else
Label3.Text = "Not a Vowel"
End If
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


TextBox1.Clear()
End Sub
End Class
-OUTPUT:
7.CALENDAR

-SOURCE CODE:

Public Class Form1


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
TextBox1.Text = DateTimePicker1.Value.DayOfWeek.ToString
TextBox2.Text = DateTimePicker1.Value.Day
TextBox3.Text = DateTimePicker1.Value.Month
TextBox4.Text = DateTimePicker1.Value.Year
End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click


TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
End Sub
End Class
-OUTPUT:
8.MENU EDITOR

-SOURCE CODE:

Public Class Form1


Dim quest(9, 3), ans(9, 1) As String
Public i As Integer = -1

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load


quest(0, 0) = "Visual Studio .NET provides which feature:"
quest(0, 1) = "Application Deployment"
quest(0, 2) = "Syntax checking and Debugging"
quest(0, 3) = "All of the above"
quest(1, 0) = "Which property determines whether a control is displayed to the user?"
quest(1, 1) = "Enabled"
quest(1, 2) = "Show"
quest(1, 3) = "Visible"
quest(2, 0) = "The Java and Visual Basic .NET belong to which type of programming
language?"
quest(2, 1) = "High-level programming language"
quest(2, 2) = "Assembly language"
quest(2, 3) = "Object-oriented programming language"
quest(3, 0) = "What is used to store decimal data in .NET?"
quest(3, 1) = "BinaryWriter"
quest(3, 2) = "DecimalWriter"
quest(3, 3) = "HexaWriter"
quest(4, 0) = "A window that lists the solution name, the project name and all the
forms used in the project."
quest(4, 1) = "Properties Window"
quest(4, 2) = "Solution Explorer"
quest(4, 3) = "Windows Form Designer"
quest(5, 0) = "Which of the following converts the expression to String data type in
VB.NET?"
quest(5, 1) = "CStr(expression)"
quest(5, 2) = "CSByte(expression)"
quest(5, 3) = "CShort(expression)"
quest(6, 0) = "Which of the following is a basic data type in VB.NET?"
quest(6, 1) = "Boolean"
quest(6, 2) = "Byte"
quest(6, 3) = "All of the above"
quest(7, 0) = "The CancelButton property belongs to which object?"
quest(7, 1) = "Form"
quest(7, 2) = "Button"
quest(7, 3) = "Label"
quest(8, 0) = "Which of the following accesss modifier specifies that a property can
be written but not read?"
quest(8, 1) = "Widening"
quest(8, 2) = "WithEvents"
quest(8, 3) = "WriteOnly"
quest(9, 0) = "Which of the following statement declares a user-defined event?"
quest(9, 1) = "Event"
quest(9, 2) = "Operator"
quest(9, 3) = "Property"
ans(0, 0) = "All of the above"
ans(1, 0) = "Visible"
ans(2, 0) = "Assembly language"
ans(3, 0) = "BinaryWriter"
ans(4, 0) = "Solution Explorer"
ans(5, 0) = "CStr(expression)"
ans(6, 0) = "All of the above"
ans(7, 0) = "Form"
ans(8, 0) = "WriteOnly"
ans(9, 0) = "Event"
Timer1.Enabled = True
Button1.Enabled = False
End Sub

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick


i=i+1
If (i = 10) Then
Timer1.Enabled = False
Button1.Enabled = True
RadioButton1.Enabled = False
RadioButton2.Enabled = False
RadioButton3.Enabled = False
TextBox1.Clear()
Else
RadioButton1.Checked = False
RadioButton2.Checked = False
RadioButton3.Checked = False
TextBox1.Text = quest(i, 0)
RadioButton1.Text = quest(i, 1)
RadioButton2.Text = quest(i, 2)
RadioButton3.Text = quest(i, 3)

End If
End Sub

Private Sub RadioButton1_CheckedChanged(sender As Object, e As EventArgs) Handles


RadioButton1.CheckedChanged
ans(i, 1) = RadioButton1.Text
End Sub

Private Sub RadioButton2_CheckedChanged(sender As Object, e As EventArgs) Handles


RadioButton2.CheckedChanged
ans(i, 1) = RadioButton2.Text
End Sub

Private Sub RadioButton3_CheckedChanged(sender As Object, e As EventArgs) Handles


RadioButton3.CheckedChanged
ans(i, 1) = RadioButton3.Text
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim j As Integer
Dim count As Integer = 0
For j = 0 To 9
If ans(j, 0) = ans(j, 1) Then
count += 1
End If
Next
Label3.Visible = True
TextBox2.Visible = True
TextBox2.Text = count
End Sub
End Class
-OUTPUT:
9.QUIZ WITH TIMER CONTROL

-SOURCE CODE:

Public Class Form1


Private Sub SaveToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
SaveToolStripMenuItem.Click
Label1.Visible = True
TextBox1.Visible = True
Save.Visible = True
End Sub

Private Sub CloseToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles


CloseToolStripMenuItem.Click
RichTextBox1.Clear()
End Sub

Private Sub CutToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles


CutToolStripMenuItem.Click
RichTextBox1.Cut()
End Sub

Private Sub CopyToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles


CopyToolStripMenuItem.Click
RichTextBox1.Copy()
End Sub

Private Sub PasteToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles


PasteToolStripMenuItem.Click
RichTextBox1.Paste()
End Sub

Private Sub Save_Click(sender As Object, e As EventArgs) Handles Save.Click


RichTextBox1.SaveFile(CStr(TextBox1.Text))
Label1.Visible = False
TextBox1.Visible = False
Save.Visible = False
End Sub

Private Sub ExitToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles


ExitToolStripMenuItem.Click
End
End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load


Label1.Visible = False
Save.Visible = False
TextBox1.Visible = False
End Sub
End Class
-OUTPUT:
10.COMMON DIALOG BOX USING FILE AND DIRECTORY CONTROLS

-SOURCE CODE:

Public Class Form1


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
If RadioButton1.Checked = True Then
FolderBrowserDialog1.ShowDialog()
TextBox1.Text = FolderBrowserDialog1.SelectedPath
Else
OpenFileDialog1.ShowDialog()
TextBox2.Text = OpenFileDialog1.FileName
End If
End Sub
End Class
-OUTPUT:
11.DRAG AND DROP OPERATION FOR TEXT

-SOURCE CODE:

Public Class Form1


Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
TextBox1.Text = "Precipitation"
TextBox2.Text = "Evaporation"
TextBox3.Text = "Condensation"
End Sub
Private MouseIsDown As Boolean = False 'variable declaration

Private Sub TextBox1_MouseDown(sender As Object, e As MouseEventArgs) Handles


TextBox1.MouseDown
MouseIsDown = True
End Sub

Private Sub TextBox1_MouseMove(sender As Object, e As MouseEventArgs) Handles TextBox1.MouseMove


If MouseIsDown Then
' Initiate dragging.
TextBox1.DoDragDrop(TextBox1.Text, DragDropEffects.Copy)
End If
MouseIsDown = False
End Sub
Private Sub TextBox4_DragEnter(sender As Object, e As DragEventArgs) Handles TextBox4.DragEnter
If (e.Data.GetDataPresent(DataFormats.Text)) Then
' Display the copy cursor.
e.Effect = DragDropEffects.Copy
Else
' Display the no-drop cursor.
e.Effect = DragDropEffects.None
End If
End Sub

Private Sub TextBox4_DragDrop(sender As Object, e As DragEventArgs) Handles TextBox4.DragDrop


If (TextBox2.Text = e.Data.GetData(DataFormats.Text)) Then
TextBox4.Text = e.Data.GetData(DataFormats.Text)
MsgBox("Correct !")
Else
MsgBox("Error")
End If
End Sub

Private Sub TextBox2_MouseDown(sender As Object, e As MouseEventArgs) Handles


TextBox2.MouseDown
MouseIsDown = True
End Sub
Private Sub TextBox2_MouseMove(sender As Object, e As MouseEventArgs) Handles
TextBox2.MouseMove
If MouseIsDown Then
' Initiate dragging.
TextBox2.DoDragDrop(TextBox2.Text, DragDropEffects.Copy)
End If
MouseIsDown = False
End Sub

Private Sub TextBox5_DragDrop(sender As Object, e As DragEventArgs) Handles TextBox5.DragDrop


If (TextBox1.Text = e.Data.GetData(DataFormats.Text)) Then
TextBox5.Text = e.Data.GetData(DataFormats.Text)
MsgBox("Correct !")
Else
MsgBox("Error")
End If
End Sub

Private Sub TextBox5_DragEnter(sender As Object, e As DragEventArgs) Handles TextBox5.DragEnter


If (e.Data.GetDataPresent(DataFormats.Text)) Then
' Display the copy cursor.
e.Effect = DragDropEffects.Copy
Else
' Display the no-drop cursor.
e.Effect = DragDropEffects.None
End If
End Sub

Private Sub TextBox6_DragEnter(sender As Object, e As DragEventArgs) Handles TextBox6.DragEnter


If (e.Data.GetDataPresent(DataFormats.Text)) Then
' Display the copy cursor.
e.Effect = DragDropEffects.Copy
Else
' Display the no-drop cursor.
e.Effect = DragDropEffects.None
End If
End Sub

Private Sub TextBox6_DragDrop(sender As Object, e As DragEventArgs) Handles TextBox6.DragDrop


If (TextBox3.Text = e.Data.GetData(DataFormats.Text)) Then
TextBox6.Text = e.Data.GetData(DataFormats.Text)
MsgBox("Correct !")
Else
MsgBox("Error")
End If
End Sub

Private Sub TextBox3_MouseDown(sender As Object, e As MouseEventArgs) Handles TextBox3.MouseDown


MouseIsDown = True
End Sub

Private Sub TextBox3_MouseMove(sender As Object, e As MouseEventArgs) Handles TextBox3.MouseMove


If MouseIsDown Then
' Initiate dragging.
TextBox3.DoDragDrop(TextBox3.Text, DragDropEffects.Copy)
End If
MouseIsDown = False
End Sub End Class
-OUTPUT:
12.DRAG AND DROP OPERATION FOR IMAGES

-SOURCE CODE:

Public Class Form1


Private mouseisdown As Boolean = False
Private comp As Boolean = False
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
PictureBox1.AllowDrop = True
PictureBox2.AllowDrop = True
PictureBox3.AllowDrop = True
End Sub

Private Sub PictureBox4_MouseDown(sender As Object, e As MouseEventArgs) Handles


PictureBox4.MouseDown
If Not PictureBox4.Image Is Nothing Then
mouseisdown = True
End If
End Sub

Private Sub PictureBox4_MouseMove(sender As Object, e As MouseEventArgs) Handles


PictureBox4.MouseMove
If mouseisdown Then
PictureBox4.DoDragDrop(PictureBox4.Image, DragDropEffects.Copy)
End If
mouseisdown = False
End Sub

Private Sub PictureBox5_MouseDown(sender As Object, e As MouseEventArgs) Handles


PictureBox5.MouseDown
If Not PictureBox5.Image Is Nothing Then
mouseisdown = True
End If
End Sub

Private Sub PictureBox5_MouseMove(sender As Object, e As MouseEventArgs) Handles


PictureBox5.MouseMove
If mouseisdown Then
PictureBox5.DoDragDrop(PictureBox5.Image, DragDropEffects.Copy)
End If
mouseisdown = False
End Sub

Private Sub PictureBox6_MouseDown(sender As Object, e As MouseEventArgs) Handles


PictureBox6.MouseDown
If Not PictureBox6.Image Is Nothing Then
mouseisdown = True
End If
End Sub
Private Sub PictureBox6_MouseMove(sender As Object, e As MouseEventArgs) Handles
PictureBox6.MouseMove
If mouseisdown Then
PictureBox6.DoDragDrop(PictureBox6.Image, DragDropEffects.Copy)
End If
mouseisdown = False
End Sub

Private Sub PictureBox1_DragDrop(sender As Object, e As DragEventArgs) Handles PictureBox1.DragDrop


PictureBox1.Image = e.Data.GetData(DataFormats.Bitmap)
If Not e.KeyState = 8 Then
PictureBox5.Image = Nothing
End If
End Sub

Private Sub PictureBox1_DragEnter(sender As Object, e As DragEventArgs) Handles PictureBox1.DragEnter


If (e.Data.GetDataPresent(DataFormats.Bitmap)) Then
If (e.KeyState = 9) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.Move
End If
Else
e.Effect = DragDropEffects.None
End If
End Sub

Private Sub PictureBox2_DragDrop(sender As Object, e As DragEventArgs) Handles PictureBox2.DragDrop


PictureBox2.Image = e.Data.GetData(DataFormats.Bitmap)
If Not e.KeyState = 8 Then
PictureBox6.Image = Nothing
End If
End Sub

Private Sub PictureBox2_DragEnter(sender As Object, e As DragEventArgs) Handles PictureBox2.DragEnter


If (e.Data.GetDataPresent(DataFormats.Bitmap)) Then
If (e.KeyState = 9) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.Move
End If
Else
e.Effect = DragDropEffects.None
End If
End Sub

Private Sub PictureBox3_DragDrop(sender As Object, e As DragEventArgs) Handles PictureBox3.DragDrop


PictureBox3.Image = e.Data.GetData(DataFormats.Bitmap)
If Not e.KeyState = 8 Then
PictureBox4.Image = Nothing
End If
End Sub

Private Sub PictureBox3_DragEnter(sender As Object, e As DragEventArgs) Handles PictureBox3.DragEnter


If (e.Data.GetDataPresent(DataFormats.Bitmap)) Then
If (e.KeyState = 9) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.Move
End If
Else
e.Effect = DragDropEffects.None
End If
End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


CompareImages(PictureBox1.Image, PictureBox5.Image)
If comp Then
PictureBox1.Image = Nothing
End If
comp = False
CompareImages(PictureBox2.Image, PictureBox6.Image)
If comp Then
PictureBox2.Image = Nothing
End If
comp = False
CompareImages(PictureBox3.Image, PictureBox4.Image)
If comp Then
PictureBox3.Image = Nothing
End If

End Sub

Sub compareimages(ByVal img1 As Image, img2 As Image)


If img1 Is img2 Then
comp = False
MsgBox("SUCCESS")
Else
MsgBox("mismatch of images")
comp = True
End If
End Sub
End Class
-OUTPUT:
13.HOTEL ROOM RESERVATION USING HTML SERVER CONTROLS

-DESIGN CODE:

<%@ Page Title="Home Page" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="true"


CodeBehind="Default.aspx.vb" Inherits="WebApplication4._Default" %>

<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">


<p>
<asp:Label ID="Label1" runat="server" Font-Italic="False" Font-Names="Corbel" Font-
Overline="False" Font-Size="X-Large" Font-Underline="True" ForeColor="Black" Text="HOTEL
ROOM BOOKING USING ASP.NET "></asp:Label><br />
<asp:Label ID="Label2" runat="server" Font-Names="Malgun Gothic" Font-Size="Medium"
Text="Guest Name : "></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" Height="31px" Width="173px"></asp:TextBox><br />
<asp:Label ID="Label3" runat="server" Font-Names="Malgun Gothic" Font-Size="Medium"
Text="Room Number:"></asp:Label>
<asp:DropDownList ID="DropDownList1" runat="server" ForeColor="Black" Height="37px"
Width="156px">
</asp:DropDownList><br />
<asp:Button ID="Button1" runat="server" Font-Bold="False" Font-Names="Maiandra GD"
Text="RESERVE ROOM" Width="130px" />
</p>
<p>
<asp:Label ID="Label4" runat="server" Font-Names="Lucida Sans Unicode" Font-
Size="Medium"></asp:Label>
</p>
</asp:Content>
-SOURCE CODE:

Public Class _Default


Inherits Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not IsPostBack Then
Dim i As Integer
For i = 1 To 10
DropDownList1.Items.Add(i)
Next
End If
Label4.Visible = False
End Sub

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


Label4.Visible = True
Label4.Text = "The room reserved for " & TextBox1.Text & " is Room No : " & DropDownList1.Text
DropDownList1.Items.Remove(DropDownList1.Text)
If DropDownList1.Items.Count = 0 Then
Button1.Enabled = False
Label4.Text = "Sorry , No rooms availlable "
End If
End Sub
End Class
-OUTPUT:
14.CREATING A FORM USING HTML SERVER CONTROL

-DESIGN CODE:

<%@ Page Title="Home Page" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="true"


CodeBehind="Default.aspx.vb" Inherits="WebApplication7._Default" %>

<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">


<p style="font-family: 'Lucida Sans Unicode'; font-size: small">
<asp:Label ID="Label2" runat="server" Font-Bold="True" Font-Names="Castellar" Font-Underline="True"
ForeColor="#336699" Text="Personal Details ~"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server" Font-Names="Lucida Sans Unicode" Font-Size="Small"
Width="121px"></asp:TextBox>
<asp:Label ID="Label7" runat="server" Font-Names="Lucida Sans Unicode" Text="Gender : "></asp:Label>
<asp:RadioButton ID="RadioButton1" runat="server" Text="Male " Width="63px" />
<asp:RadioButton ID="RadioButton2" runat="server" Text="Female" Width="90px" />
<asp:Label ID="Label11" runat="server" Font-Names="Lucida Sans Unicode" Text="Place Of Birth
:"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server" Font-Names="Lucida Sans Unicode" Font-Size="Small"
Width="123px"></asp:TextBox>
<asp:TextBox ID="TextBox3" runat="server" Height="16px" Width="118px" Font-Names="Lucida Sans
Unicode" Font-Size="Small"></asp:TextBox>
<asp:TextBox ID="TextBox5" runat="server" Font-Names="Lucida Sans Unicode" Font-Size="Small"
Width="118px"></asp:TextBox>
<asp:Label ID="Label9" runat="server" Font-Names="Lucida Sans Unicode" Text="Fathers
Occupation :"></asp:Label>
<asp:TextBox ID="TextBox4" runat="server" Height="17px" Width="111px" Font-Names="Lucida Sans
Unicode" Font-Size="Small"></asp:TextBox>>
<asp:RadioButton ID="RadioButton3" runat="server" Text="Parent" />
<asp:RadioButton ID="RadioButton4" runat="server" Text="Guardian" />
<asp:Label ID="Label27" runat="server" Font-Names="Lucida Sans Unicode" Text="Date Of Birth
:"></asp:Label>
<asp:TextBox ID="TextBox13" runat="server"></asp:TextBox>
</p>
<p>
<asp:Calendar ID="Calendar2" runat="server" BackColor="White" BorderColor="#3366CC"
BorderWidth="1px" CaptionAlign="Right" CellPadding="1" DayNameFormat="Shortest" Font-
Names="Verdana" Font-Size="8pt" ForeColor="#003399" Height="162px" TabIndex="5" Width="240px"
SelectedDate="2002-04-08" VisibleDate="2002-04-01">
<DayHeaderStyle BackColor="#99CCCC" ForeColor="#336666" Height="1px" />
<NextPrevStyle Font-Size="8pt" ForeColor="#CCCCFF" />
<OtherMonthDayStyle ForeColor="#999999" VerticalAlign="Middle" />
<SelectedDayStyle BackColor="#009999" Font-Bold="True" ForeColor="#CCFF99" />
<SelectorStyle BackColor="#99CCCC" ForeColor="#336666" />
<TitleStyle BackColor="#003399" BorderColor="#3366CC" BorderWidth="1px" Font-Bold="True" Font-
Size="10pt" ForeColor="#CCCCFF" Height="25px" />
<TodayDayStyle BackColor="#99CCCC" ForeColor="White" />
<WeekendDayStyle BackColor="#CCCCFF" />
</asp:Calendar>
<asp:Label ID="Label12" runat="server" Font-Bold="True" Font-Names="Castellar" Font-Underline="True"
ForeColor="#CC3300" Text="Contact Details ~"></asp:Label>
<asp:Label ID="Label13" runat="server" Font-Names="Lucida Sans Unicode" Text="Phone no
:"></asp:Label>
<asp:TextBox ID="TextBox6" runat="server" Height="20px" Width="154px" Font-Names="Lucida Sans
Unicode" Font-Size="Small"></asp:TextBox>
<asp:TextBox ID="TextBox9" runat="server" Height="28px" Width="205px" Font-Names="Lucida Sans
Unicode" Font-Size="Small"></asp:TextBox>
</p>
<p>
<asp:Label ID="Label14" runat="server" Font-Names="Lucida Sans Unicode" Text="Address
:"></asp:Label>
<asp:TextBox ID="TextBox7" runat="server" Height="56px" Width="177px" Font-Names="Lucida Sans
Unicode" Font-Size="Small"></asp:TextBox>
<asp:Label ID="Label17" runat="server" Font-Names="Lucida Sans Unicode" Text="State :"></asp:Label>
<asp:TextBox ID="TextBox10" runat="server" Height="17px" Width="169px" Font-Names="Lucida Sans
Unicode" Font-Size="Small"></asp:TextBox>
</p>
<p style="font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva,
Verdana, sans-serif; font-size: small">
<asp:Label ID="Label15" runat="server" Font-Names="Lucida Sans Unicode" Text="Country
:"></asp:Label>
<asp:TextBox ID="TextBox8" runat="server" Height="25px" Width="179px" Font-Names="Lucida Sans
Unicode" Font-Size="Small"></asp:TextBox>
<asp:Label ID="Label18" runat="server" Font-Names="Lucida Sans Unicode" Text="Nationality
:"></asp:Label>
<asp:RadioButton ID="RadioButton5" runat="server" Text="Indian" Width="63px" />
<asp:RadioButton ID="RadioButton6" runat="server" Text="Other" />
<p>
<asp:Label ID="Label20" runat="server" Font-Names="Lucida Sans Unicode" Text="Percentage secured in
12th :"></asp:Label>
<asp:TextBox ID="TextBox11" runat="server" Font-Names="Lucida Sans Unicode" Font-Size="Small"
Height="23px"></asp:TextBox>
<asp:Label ID="Label21" runat="server" Font-Names="Lucida Sans Unicode" Text="Percentage secured in
10th :"></asp:Label>
<asp:TextBox ID="TextBox12" runat="server" Font-Names="Lucida Sans Unicode" Font-Size="Small"
Height="22px"></asp:TextBox>
<asp:Label ID="Label22" runat="server" Font-Names="Lucida Sans Unicode" Text="Upload marksheets of
10 and 12 : "></asp:Label>
<asp:Label ID="Label28" runat="server" Font-Names="Lucida Sans Unicode" Text="Category
:"></asp:Label>
<asp:ListBox ID="ListBox1" runat="server" Font-Names="Lucida Sans Unicode" Font-Size="Small"
Height="25px" Width="103px">
<asp:ListItem>SC</asp:ListItem>
<asp:ListItem>ST</asp:ListItem>
<asp:ListItem>OBC</asp:ListItem>
<asp:ListItem>General</asp:ListItem>
<asp:ListItem>Other</asp:ListItem>
</asp:ListBox>
</p>
<p>
<asp:Label ID="Label25" runat="server" Font-Names="Lucida Sans Unicode" Text="Choose course ( First
Preference ) :"></asp:Label>
<asp:DropDownList ID="DropDownList1" runat="server" Font-Names="Lucida Sans Unicode" Font-
Size="Small">
<asp:ListItem>Data Analytics</asp:ListItem>
<asp:ListItem>Cyber Security</asp:ListItem>
<asp:ListItem>Machine Learning</asp:ListItem>
<asp:ListItem>Moral Hacking</asp:ListItem>
<asp:ListItem>Network Security</asp:ListItem>
<asp:ListItem>Artificial Intelligence</asp:ListItem>
<asp:ListItem>Cloud Computing</asp:ListItem>
<asp:ListItem>Robotics</asp:ListItem>
<asp:ListItem>NanoTechnology</asp:ListItem>
</asp:DropDownList>
</p>

<p style="font-size: small; font-family: 'Lucida Sans Unicode'">


<asp:Label ID="Label24" runat="server" Font-Names="Lucida Sans Unicode" Text="Preferred
Location :"></asp:Label>
<asp:CheckBox ID="CheckBox1" runat="server" Text="Mumbai" />
<asp:CheckBox ID="CheckBox2" runat="server" Text="Chennai" />
<asp:CheckBox ID="CheckBox3" runat="server" Text="Bangalore" />
<asp:CheckBox ID="CheckBox4" runat="server" Text="Delhi" />
<asp:CheckBox ID="CheckBox5" runat="server" Text="Goa" />
<asp:CheckBox ID="CheckBox6" runat="server" Text="Bombay" />
<asp:Button ID="Button1" runat="server" Height="30px" Text="SUBMIT" Width="83px" />

</asp:Content>

SOURCE CODE :

Public Class _Default


Inherits Page

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click


MsgBox("Thank you for Registering at our University !!")
End Sub

End Class
-OUTPUT:
15. PRODUCT DETAILS USING WEB SERVER CONTROLS

-DESIGN CODE:

<%@ Page Title="Home Page" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="true"


CodeBehind="Default.aspx.vb" Inherits="WebApplication5._Default" %>

<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">


<p>
<asp:Label ID="Label6" runat="server" Font-Names="Algerian" Font-Size="XX-Large" Font-
Underline="True" Text="ROYAL GROCERIES&nbsp;" ForeColor="#003399"></asp:Label>
<asp:Label ID="Label7" runat="server" Font-Names="Maiandra GD" Font-Size="X-Large" Font-
Underline="True" Text="The Items availlable in stock and for delivery are : "></asp:Label><br />
<asp:Button ID="Button3" runat="server" Font-Bold="True" Font-Names="Lucida Sans" Font-
Size="Medium" Height="28px" Text="GET COST --&gt; " Width="130px" />
<asp:Label ID="Label8" runat="server" Font-Bold="True" Font-Names="Lucida Sans Unicode" Font-
Size="Medium"></asp:Label><br />
</p>
<p>
<asp:Label ID="Label9" runat="server" Font-Names="Lucida Sans Unicode" Font-Size="Large"
Text="Enter Quantity : "></asp:Label>
<asp:TextBox ID="TextBox2" runat="server" Width="164px"></asp:TextBox><br />
<asp:Button ID="Button4" runat="server" Font-Bold="True" Font-Names="Lucida Sans" Font-
Size="Medium" Text="BUY ITEM " />
<asp:Label ID="Label10" runat="server" Font-Bold="True" Font-Names="Lucida Sans Unicode"
Font-Size="Large"></asp:Label><br />
<asp:Label ID="Label11" runat="server" Font-Names="Algerian" Font-Size="Medium"
ForeColor="#003399"></asp:Label>
</p>

</asp:Content>
-SOURCE CODE:

Public Class _Default


Inherits Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Not IsPostBack Then
ListBox1.Items.Add("Diary Milk")
ListBox1.Items.Add("5 Star")
ListBox1.Items.Add("Snickers")
ListBox1.Items.Add("Gems")
ListBox1.Items.Add("Munch")
End If
End Sub

Protected Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click


Dim i As Integer
Dim cost As Integer
i = ListBox1.SelectedIndex
If (i = 0) Then
cost = 50
ElseIf (i = 1) Then
cost = 20
ElseIf (i = 2) Then
cost = 40
ElseIf (i = 3) Then
cost = 15
ElseIf (i = 4) Then
cost = 10
End If
Label8.Text = "The Item chosen is " & ListBox1.SelectedItem.Value & " and the cost is Rs . " & cost
End Sub

Protected Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click


Dim qty As Integer
Dim total As Integer
qty = Val(TextBox2.Text)
Dim j As Integer
j = ListBox1.SelectedIndex
If (j = 0) Then
total = qty * 50
ElseIf (j = 1) Then
total = qty * 20
ElseIf (j = 2) Then
total = qty * 40
ElseIf (j = 3) Then
total = qty * 15
ElseIf (j = 4) Then
total = qty * 10
End If
Label10.Text = "The total price to be paid is Rs. " & total
Label11.Text = " Thank you for shopping with us !! "
End Sub
End Class
-OUTPUT:
16.REGISTRATION FORM USING VALIDATOR CONTROLS

-DESIGN CODE:

<%@ Page Title="Home Page" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="true"


CodeBehind="Default.aspx.vb" Inherits="WebApplication12._Default" %>

<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">


<p>
<asp:Label ID="Label1" runat="server" Text="LOGIN FORM"></asp:Label>
<asp:Label ID="Label2" runat="server" Text="Enter the username :"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
ErrorMessage="*Please type the username"></asp:RequiredFieldValidator>
<asp:Label ID="Label3" runat="server" Text="Enter the Password :"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</p>
<p>
<asp:Label ID="Label4" runat="server" Text="Retype the Password :"></asp:Label>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="TextBox2"
ControlToValidate="TextBox3" Display="Dynamic" ErrorMessage="*Password
Mismatch"></asp:CompareValidator>
<asp:Label ID="Label5" runat="server" Text="Enter the Email Id :"></asp:Label>
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ControlToValidate="TextBox4" ErrorMessage="*Enter Valid emailID" ValidationExpression=
"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
<asp:Label ID="Label6" runat="server" Text="Enter the Age :"></asp:Label>
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
<asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage=" *Age must be between 20-30"
MaximumValue="30" MinimumValue="20"></asp:RangeValidator>
<asp:Label ID="Label7" runat="server" Text="Enter the mobile no.:"></asp:Label>
<asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="*Type valid
mobilenumber"></asp:RequiredFieldValidator>
<asp:Button ID="Button1" runat="server" Text="SUBMIT" />
<asp:ValidationSummary ID="ValidationSummary1" runat="server" />
</p>
</asp:Content>
-SOURCE CODE:

Public Class _Default


Inherits Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles  Me.Load
End Sub

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click If (Page.IsValid)


Then
Label1.Text = "Your Form has been Submitted ~"
Else
Label1.Text = "Error Loading Form , Please Retry "
End If

End Sub
End Class
-OUTPUT:
17.ADROTATOR CONTROL

-DESIGN CODE:

<%@ Page Title="Home Page" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="true"


CodeBehind="Default.aspx.vb" Inherits="WebApplication8._Default" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
</p>
<asp:Label ID="Label1" runat="server" Font-Names="Algerian" Font-Underline="True"
ForeColor="#6600FF" Text="FRESH BOUQUETS"></asp:Label>

<asp:Label ID="Label2" runat="server" Font-Names="Baskerville Old Face" Font-Size="Medium"


Text="Presenting the best online flourist shops for 24h delivery, colorful blossom bouquets at your desired
place -!"></asp:Label>

<asp:AdRotator ID="AdRotator1" runat="server" AdvertisementFile="~/XMLFile1.xml" />


&nbsp;</p>

<asp:Label ID="Label4" runat="server" Font-Bold="True" Font-Names="Javanese Text" Font-


Underline="True" ForeColor="Fuchsia" Text="Use our coupon TRYNEW425 to get 50% OFF at your first
delivery !!"></asp:Label>
<p>
<p>
<asp:Label ID="Label5" runat="server" Font-Names="Algerian" Text="THANK YOU : )"></asp:Label>

</asp:Content>
-SOURCE CODE:

<?xml version="1.0" encoding="utf-8" ?>


<Advertisements>
<Ad>
<ImageUrl>bouquet1.jpg</ImageUrl>
<NavigateUrl>https://www.floweraura.com/sendflowers/chennai</NavigateUrl>
<AlternateText>
Blue Bouquets @125 , Here
</AlternateText>
<Impressions>20</Impressions>
<Keyword>Chennai,Flower Aura</Keyword>
</Ad>

<Ad>
<ImageUrl>bouquet2.jpg</ImageUrl>
<NavigateUrl>https://www.fnp.com/flower-bouquets</NavigateUrl>
<AlternateText>Order imported UK flowers</AlternateText>
<Impressions>20</Impressions>
<Keyword>Get free vouchers</Keyword>
</Ad>

<Ad>
<ImageUrl>bouqet3.jpg</ImageUrl>
<NavigateUrl>https://www.chennaionlineflorists.com/</NavigateUrl>
<AlternateText>Send flowers anywhere in India</AlternateText>
<Impressions>20</Impressions>
<Keyword>Gift</Keyword>
</Ad>

<Ad>
<ImageUrl>bouquet4.jpg</ImageUrl>
<NavigateUrl>https://www.winni.in/flowers</NavigateUrl>
<AlternateText>Exquisite Tulip Collectkion</AlternateText>
<Impressions>20</Impressions>
<Keyword>Red,Black</Keyword>
</Ad>
</Advertisements>
-OUTPUT:
18.CALENDAR CONTROL

-DESIGN CODE:

<%@ Page Title="Home Page" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="true"


CodeBehind="Default.aspx.vb" Inherits="WebApplication9._Default" %>

<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">


<p >

<asp:Label ID="Label1" runat="server" Font-Names="Algerian" Font-Size="X-Large" Font-


Underline="True" Text="HOLIDAYS IN THE MONTH OF NOVEMBER"></asp:Label>

<asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="Black"


DayNameFormat="Shortest" Font-Names="Times New Roman" Font-Size="10pt" ForeColor="Black"
Height="390px" NextPrevFormat="FullMonth" SelectedDate="2021-10-22" TitleFormat="Month"
Width="620px">
<DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" ForeColor="#333333"
Height="10pt" />
<DayStyle Width="14%" />
<NextPrevStyle Font-Size="8pt" ForeColor="White" />
<OtherMonthDayStyle ForeColor="#999999" Wrap="False" />
<SelectedDayStyle BackColor="#CC3333" ForeColor="White" />
<SelectorStyle BackColor="#CCCCCC" Font-Bold="True" Font-Names="Verdana" Font-
Size="8pt" ForeColor="#333333" Width="1%" />
<TitleStyle BackColor="Black" Font-Bold="True" Font-Size="13pt" ForeColor="White"
Height="14pt" />
<TodayDayStyle BackColor="#CCCC99" />
</asp:Calendar>

</p>
</asp:Content>
-SOURCE CODE:

Public Class _Default


Inherits Page
Dim Holidays(13, 31)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load

Holidays(11, 19) = "Guru Nanak Jayanthi"


Holidays(11, 4) = "Diwali"
End Sub

Private Sub Calendar1_DayRender(sender As Object, e As DayRenderEventArgs) Handles


Calendar1.DayRender
If e.Day.IsOtherMonth Then
e.Cell.Controls.Clear()
Else
Dim adate As Date = e.Day.Date
Dim aholidays As String = Holidays(adate.Month, adate.Day)
If (Not aholidays Is Nothing) Then
Dim alabel As New Label()

alabel.Text = "<br>" & aholidays


e.Cell.Controls.Add(alabel)
End If
End If
End Sub
End Class
-OUTPUT:
19.LOGIN VALIDATION WITH APPLICATION VARIABLE

-DESIGN CODE:

<%@ Page Title="Home
Page" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.asp
x.vb" Inherits="login_control._Default" %>
 
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
 
    <div class="jumbotron">
        <h1>
            <asp:Login ID="Login1" runat="server" BackColor="#F7F6F3" BorderColor="#E6E2D8" BorderPad
ding="4" BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-
Size="0.8em" ForeColor="#333333" Height="504px" Width="747px">
                <InstructionTextStyle Font-Italic="True" ForeColor="Black" />
                <LoginButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC" BorderStyle="Solid" Borde
rWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284775" />
                <TextBoxStyle Font-Size="0.8em" />
                <TitleTextStyle BackColor="#5D7B9D" Font-Bold="True" Font
Size="0.9em" ForeColor="White" />
            </asp:Login>
        </h1>
    </div>
</asp:Content>
 

 
-SOURCE CODE:

Public Class _Default
        Inherits System.Web.UI.Page
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            Application("i") = Int(Application("i") + 1)
            If Application("i") > 4 Then
                Application("i") = 0
            End If
        End Sub
    Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.Au
thenticateEventArgs) Handles Login1.Authenticate
        If Login1.UserName = "keerthana" And Login1.Password = "bca" Then
            MsgBox("your are successfully logged i")
        End If
        If (Application("i") = 4) Then
                MsgBox("you are blocked")
                Login1.Enabled = False
            End If
        End Sub
-OUTPUT:
20.STATE MANAGEMENT TECHNIQUE USING APPLICATION AND SESSION

-DESIGN CODE:

<%@ Page Title="Home Page" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="true"


CodeBehind="Default.aspx.vb" Inherits="html._Default" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<p>
<asp:Login ID="Login1" runat="server" Height="152px" Width="320px">
<HyperLinkStyle HorizontalAlign="Center" />
<InstructionTextStyle HorizontalAlign="Center" />
<LabelStyle HorizontalAlign="Center" />
</asp:Login>
<p style="color: #000099">
<asp:Label ID="Label3" runat="server" Text="THE SOCIALS" Font-Names="Algerian" Font-
Underline="True" style="font-size: 40pt"></asp:Label>
<p style="color: #0066CC; font-family: 'Lucida Sans Unicode'">
<asp:Image ID="Image2" runat="server" Height="162px" ImageUrl="~/pasta.jpg" Width="252px" />
<asp:Image ID="Image3" runat="server" Height="156px" ImageUrl="~/burger.jpg" Width="272px" />
<asp:Image ID="Image4" runat="server" Height="152px" ImageUrl="~/pizza2.jpg" Width="294px" />
<p>

<ol style="font-family: 'Lucida Sans',Verdana, sans-serif">


<li><span style="color: #000099; font-family: 'Bahnschrift SemiLight';"><span style="font-size:
15pt">&nbsp;Sandwiches </li>
</span>
<ul>
<li>Russian Mayo </li>
<li>Tandoori Paneer</li>
<li>Triple Barbequed Kheema </li>
<li style="height: 21px; width: 688px">Hot and Spicy Chicken FiestA</li>
</ul>

<li ><span style="color: #000099; font-family: 'Bahnschrift SemiLight';">&nbsp;<span style="font-size:


14pt">Pasta</span> </li>
</span>
<ul>
<li>Italian Olive</li>
<li>Mac And Cheese</li>
<li>Aglio Oglio</li>
<p>COMBOS</p>
<ul>
<li>Spring Raineese</li>
<li>LasangaSpaggheti </li>
<li>DipTomsShrimp Trynia</li>
</ul>
</ul>
<li><span style="color: #000099; font-family: 'Bahnschrift SemiLight'; font-size: 13pt;">&nbsp;
Pizza</span><ul>
<li>Chicken Dominator</li>
<li>4 Cheese Margherita</li>
<li>Pepperoni Combo</li>
<li>BBQ Corn&#39;n&#39;Spice</li>
</ul>
<li><span style="color: #000099; font-family: 'Bahnschrift SemiLight';">&nbsp; <span style="font-size:
13pt">Beverages and Deserts</b> </li>
<ul>
<li>Pepsi </li>
<li>Mountain Dew </li>
<ul>
<li>Mousse Cake</li>
<LI>Vanilla Spin</LI>
<li>Chocolate Truffle</li>
</ul>
</ul>
</ol>
<dl> <dt><b> ******</b></dt>
<dd style="color: #FF3300"> Special Offers starting from 1Nov till 4 Nov </dd>
<dt><b>TRYNEW </b></dt>
<dd style="color: #FF0066"> Use this exclusive coupon to get 50%off, validity ends at 11:59pm
tonight</dd>
</dl>
<asp:Image ID="Image6" runat="server" Height="199px" ImageUrl="~/sandwich.jpg"
Width="263px" />
<asp:Image ID="Image7" runat="server" Height="190px" ImageUrl="~/desert.jpg" Width="269px" />
&nbsp;<asp:Label ID="Label4" runat="server" Text="REACH US :" Font-Names="Felix Titling" Font-
Underline="True"></asp:Label>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>

</asp:Content>
-SOURCE CODE:

Imports System.Web.Optimization

Public Class Global_asax


Inherits HttpApplication

Sub Application_Start(sender As Object, e As EventArgs)


' Fires when the application is started
RouteConfig.RegisterRoutes(RouteTable.Routes)
BundleConfig.RegisterBundles(BundleTable.Bundles)

Application("visits") = 0
End Sub
Sub Session_Start(sender As Object, e As EventArgs)
Session("my_text") = "USER"
End Sub

End Class

Public Class _Default


Inherits Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load

Application("visits") = Application("visits") + 1
Label1.Text = Application("visits")

End Sub

Protected Sub Login1_Authenticate(sender As Object, e As AuthenticateEventArgs) Handles


Login1.Authenticate
If Login1.UserName = "Rebecca" And Login1.Password = "rebe" Then
MsgBox("login successful")
Login1.Visible = False
ViewState.Add("uname", Login1.UserName)
Dim uname As String
uname = ViewState("uname").ToString

Label2.Text = "Welcome " + uname + ", what is your order today ? "
End If
End Sub
End Class
-OUTPUT:
21.XML DATABASE CONNECTION

-DESIGN CODE:

<%@ Page Title="Home Page" Language="VB" MasterPageFile="~/Site.Master" AutoEventWireup="true"


CodeBehind="Default.aspx.vb" Inherits="WebApplication10._Default" %>
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<p>
<asp:Label ID="Label1" runat="server" Font-Names="Algerian" Font-Size="XX-Large" Font-
Underline="True" style="font-size: 23pt" Text="ANNUAL STUDENT RECORD-BCA"></asp:Label>
<asp:GridView ID="GridView1" runat="server" BackColor="White" BorderColor="#999999"
BorderStyle="Solid" BorderWidth="1px" CellPadding="3" ForeColor="Black" GridLines="Vertical"
Height="314px" Width="650px" CellSpacing="3" HorizontalAlign="Center">
<AlternatingRowStyle BackColor="#CCCCCC" />
<EditRowStyle BorderStyle="Dotted" HorizontalAlign="Center" />
<FooterStyle BackColor="#CCCCCC" />
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<RowStyle HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White"
HorizontalAlign="Center" />
<SortedAscendingCellStyle BackColor="#F1F1F1" HorizontalAlign="Center" />
<SortedAscendingHeaderStyle BackColor="#808080" BorderStyle="Solid" HorizontalAlign="Center" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#383838" />
</asp:GridView>
</p>
<p><asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/XMLFile1.xml"></asp:XmlDataSource></p>

</asp:Content>
-SOURCE CODE:

Imports System.Data
Public Class _Default
Inherits Page

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load


Dim data As New DataSet
data.ReadXml(MapPath("XMLFile1.xml"))
GridView1.DataSource = data
GridView1.DataBind()
End Sub
End Class

XML FILE
<?xml version="1.0" encoding="utf-8" ?>
<Students>
<stud>
<RollNo > 400243 </RollNo>
<StudName > Tara </StudName>
<VB.NET > 92 </VB.NET>
<Python > 87 </Python>
<PHP > 80 </PHP>
<BatchNo. >2 </BatchNo.>
<Result >Pass </Result>
<Yop >2021 </Yop>
</stud>

<stud>
<RollNo> 400241 </RollNo>
<StudName> Payal </StudName>
<VB.NET> 29 </VB.NET>
<Python> 30</Python>
<PHP> 33 </PHP>
<BatchNo.>1</BatchNo.>
<Result>Fail</Result>
<Yop>2021</Yop>
</stud>

<stud>
<RollNo> 400244 </RollNo>
<StudName> Kriti </StudName>
<VB.NET> 98 </VB.NET>
<Python> 99 </Python>
<PHP> 100 </PHP>
<BatchNo.>1</BatchNo.>
<Result>Pass</Result>
<Yop>2021</Yop>
</stud>
<stud>
<RollNo> 400248 </RollNo>
<StudName> Yash </StudName>
<VB.NET> 35 </VB.NET>
<Python> 35 </Python>
<PHP> 33 </PHP>
<BatchNo.>2</BatchNo.>
<Result>Fail</Result>
<Yop>2021</Yop>
</stud>

<stud>
<RollNo> 400247 </RollNo>
<StudName> Rahul </StudName>
<VB.NET> 80 </VB.NET>
<Python> 90 </Python>
<PHP> 70 </PHP>
<BatchNo.>1</BatchNo.>
<Result>Pass</Result>
<Yop>2021</Yop>
</stud>

<stud>
<RollNo> 400249 </RollNo>
<StudName> Smritika </StudName>
<VB.NET> 78 </VB.NET>
<Python> 65 </Python>
<PHP> 91 </PHP>
<BatchNo.>2</BatchNo.>
<Result>Pass</Result>
<Yop>2021</Yop>
</stud>

</Students>
OUTPUT:

You might also like