Department of Computer Science: (UCS15404) Lab Manual

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 46

Department of Computer Science

Visual Basic.NET LAB

(UCS15404)

LAB MANUAL

For

BSc Degree Programme – 2015 Regulation

Academic Year (2017 – 2020) ( Even) - Fourth Semester

Prepared By Approved By

Mrs.R.Sivasankari HOD
INDEX

Exercise Program Name


No.
Calculate Area of Circle using Console Application
1.

Area of Triangle using Window Application


2.

Currency Conversion using Window Application


3.

Salary Calculation using Window Application


4.

Retrieve images using Combo Box and Button


5.

Simulate a Paint Brush Application


6.

Move an object using Timer Control


7.

8. Develop a Math Calculator.

9. Create an Application using the Form Controls.

10. Create an application using the form controls and perform all validation
operations.

11. Develop a program which makes use of String and String Builder class.

12. Create a Text Pad Application.

13. Develop a VB.NET application using menu.

14. Create an application using Common Dialog Controls.

15. Create a database driven application to manage employee database.


Exercise 1:

CALCULATE AREA OF CIRCLE USING CONSOLE APPLICATIONS

AIM:

To calculate the area of a circle for given radius using console application .

PROGRAM:

Module Module1
Sub Main()
Dim r, area As Double
Console.Write("Enter Radius:")
r = Console.ReadLine()
area = 3.14 * r * r
Console.Write("Area of Circle:")
Console.WriteLine(area)
Console.ReadKey()
End Sub
End Module
INPUT&OUTPUT:

RESULT:
Thus the program has been successfully completed & executed.
Exercise 2:

AREA OF TRIANGLE USING WINDOW APPLICATION


AIM:
To calculate area of triangle using window application.

PROGRAM:
Public Class Form1

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click
End

End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim b, h, area As Double
b = Val(TextBox1.Text)
h = Val(TextBox2.Text)
area = 0.5 * b * h
TextBox3.Text = Str(area)
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox1.Focus()
End Sub

End Class
INPUT&OUPUT:

RESULT:
Thus the program has been successfully completed & executed.
Exercise 3:

CURRENCY CONVERSION USING WINDOW APPLICATION


AIM:
To convert currency values using window application.

PROGRAM:
Public Class Form

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
Dim v, res, val1, val2 As Double
If ComboBox1.SelectedItem = "Rupee" Then
val1 = 1.0
ElseIf ComboBox1.SelectedItem = "Dollar" Then
val1 = 67.5
ElseIf ComboBox1.SelectedItem = "Euro" Then
val1 = 73
End If
If ComboBox2.SelectedItem = "Rupee" Then
val2 = 1.0
ElseIf ComboBox2.SelectedItem = "Dollar" Then
val2 = 67.5
ElseIf ComboBox2.SelectedItem = "Euro" Then
val2 = 73
End If
v = Val(TextBox1.Text)
res = v * val1 / val2
TextBox2.Text = Str(res)
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox1.Focus()
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click
End
End Sub
End Class
INPUT&OUPUT:

RESULT:
Thus the program has been successfully completed & executed.
Exercise 4:
SALARY CALCULATION USING WINDOW APPLICATION

AIM:
To calculate salary using window application.

PROGRAM:
PublicClass Form1

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


System.EventArgs) Handles Button3.Click
End
EndSub

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


System.EventArgs) Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
TextBox1.Focus()
EndSub

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


System.EventArgs) Handles Button1.Click
Dim bp, hr, cc, ta, gp, pf, lic, td, np AsDouble
bp = Val(TextBox1.Text)
hr = Val(TextBox2.Text)
cc = Val(TextBox3.Text)
pf = Val(TextBox6.Text)
lic = Val(TextBox7.Text)
ta = hr + cc
gp = bp + ta
td = pf + lic
np = gp - td
TextBox4.Text = Str(ta)
TextBox5.Text = Str(gp)
TextBox8.Text = Str(td)
TextBox9.Text = Str(np)
EndSub
EndClass

INPUT&OUTPUT:

RESULT:
Thus the program as been successfully completed & executed.

Exercise 5:
RETREIVE IMAGES USING COMBOBOX AND BUTTON

AIM:
To retreive images using combobox and button.
PROGRAM:
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If (ComboBox1.SelectedIndex = 0) Then
PictureBox1.Image = Image.FromFile("C:\Users\sbca177\Desktop\s1.jpg")
ElseIf (ComboBox1.SelectedIndex = 1) Then
PictureBox1.Image = Image.FromFile("C:\Users\sbca177\Desktop\s2.jpg")
ElseIf (ComboBox1.SelectedIndex = 2) Then
PictureBox1.Image = Image.FromFile("C:\Users\sbca177\Desktop\s3.jpg")
ElseIf (ComboBox1.SelectedIndex = 3) Then
PictureBox1.Image = Image.FromFile("C:\Users\sbca177\Desktop\s4.jpg")
ElseIf (ComboBox1.SelectedIndex = 4) Then
PictureBox1.Image = Image.FromFile("C:\Users\sbca177\Desktop\s5.jpg")
End If
End Sub
End Class
INPUT&OUTPUT:

RESULT:
Thus the program has been successfully completed & executed.
Exercise 6:

SIMULATE A PAINT BRUSH APPLICATION

AIM:
To simulate a paint brush application using mouse event.

PROGRAM:
Public Class Form1
Dim mybrush
Dim down As Boolean

Private Sub PictureBox1_MouseDown(ByVal sender As Object, ByVal e As


System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseDown
down = True
End Sub

Private Sub PictureBox1_MouseMove(ByVal sender As Object, ByVal e As


System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseMove
If down = True Then
PictureBox1.CreateGraphics.FillEllipse(mybrush, e.X, e.Y, 10, 10)
End If

End Sub

Private Sub PictureBox1_MouseUp(ByVal sender As Object, ByVal e As


System.Windows.Forms.MouseEventArgs) Handles PictureBox1.MouseUp
down = False
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click

mybrush = Brushes.Black
Dim down = False

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
mybrush = Brushes.Gray
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click
mybrush = Brushes.Red
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button4.Click
mybrush = Brushes.Blue
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button5.Click
mybrush = Brushes.Yellow
End Sub

Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles PictureBox1.Click

End Sub
End Class
OUTPUT:

RESULT:
Thus the program has been successfully completed & executed.
Exercise 7:

MOVE AN OBJECT USING TIMER CONTROL


AIM:
To move an object using Timer Control.

PROGRAM:
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
If (ComboBox1.SelectedIndex = 0) Then
PictureBox1.Image = Image.FromFile("C:\Users\Public\Pictures\Sample
Pictures\rf.jpg")
ElseIf (ComboBox1.SelectedIndex = 1) Then
PictureBox1.Image = Image.FromFile("C:\Users\Public\Pictures\Sample
Pictures\ht.png")
End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
Timer1.Enabled = True
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Timer1.Tick
PictureBox1.Location = New Point(PictureBox1.Location.X + 5,
PictureBox1.Location.Y)
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click
End
End Sub
End Class
OUTPUT:

RESULT:
Thus the program has been successfully completed & executed.
Exercise 8:

SIMULATE MATH CALCULATOR USING WINDOW APPLICATIONS

AIM:
To create a math calculator using window application for performing basic arithmetic
operation.

PROGRAM:
Public Class Form1
Dim fno, sno, ans As Single
Dim Operation As String

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button1.Click
TextBox1.Text = TextBox1.Text & 1
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button2.Click
TextBox1.Text = TextBox1.Text & 2
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button3.Click
TextBox1.Text = TextBox1.Text & 3
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button4.Click
TextBox1.Text = TextBox1.Text & 4
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button5.Click
TextBox1.Text = TextBox1.Text & 5
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button6.Click
TextBox1.Text = TextBox1.Text & 6
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button7.Click
TextBox1.Text = TextBox1.Text & 7
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button8.Click
TextBox1.Text = TextBox1.Text & 8
End Sub

Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button9.Click
TextBox1.Text = TextBox1.Text & 9
End Sub

Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button10.Click
TextBox1.Text = TextBox1.Text & 0
End Sub

Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button14.Click
TextBox1.Text = TextBox1.Text & "."
End Sub

Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button17.Click
TextBox1.Text = " "
TextBox1.Focus()
End Sub

Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button18.Click
End
End Sub

Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button11.Click
fno = Val(TextBox1.Text)
TextBox1.Text = " "
Operation = "+"
End Sub

Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button12.Click
fno = Val(TextBox1.Text)
TextBox1.Text = " "
Operation = "-"
End Sub
Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button13.Click
fno = Val(TextBox1.Text)
TextBox1.Text = " "
Operation = "x"
End Sub

Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button16.Click
fno = Val(TextBox1.Text)
TextBox1.Text = " "
Operation = "/"
End Sub

Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles Button15.Click
sno = Val(TextBox1.Text)
If Operation = "+" Then
ans = fno + sno
End If
If Operation = "-" Then
ans = fno - sno
End If
If Operation = "x" Then
ans = fno * sno
End If

If Operation = "/" Then


ans = fno / sno
End If
TextBox1.Text = ans
End Sub
End Class

INPUT&OUTPUT:
RESULT:
Thus the program has been successfully completed & executed.
Exercise 9:
Create an Application using the Form Controls.

AIM:
To Create an Application using the Form Controls.

PROGRAM:
PublicClassForm1

PrivateSub Button2_Click(ByVal sender AsSystem.Object, ByVal e AsSystem.EventArgs)


Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
ComboBox1.Text = ""
ComboBox2.Text = ""
TextBox1.Focus()

EndSub

PrivateSub Button1_Click(ByVal sender AsSystem.Object, ByVal e AsSystem.EventArgs)


Handles Button1.Click
MsgBox("registered successfullly")
ListBox1.Items.Add("Reg.No:"& TextBox1.Text)
ListBox1.Items.Add("Name:"& TextBox2.Text & TextBox3.Text)
If RadioButton1.Checked Then
ListBox1.Items.Add("Gender:"& RadioButton1.Text)
EndIf
If RadioButton2.Checked Then
ListBox1.Items.Add("Gender:"& RadioButton2.Text)
EndIf
If RadioButton3.Checked Then
ListBox1.Items.Add("Gender:"& RadioButton3.Text)
EndIf
ListBox1.Items.Add("College:"& TextBox4.Text)
ListBox1.Items.Add("Department:"& ComboBox1.Text)
ListBox1.Items.Add("Passed out:"& ComboBox2.Text)
EndSub
EndClass

INPUT&OUTPUT:
RESULT:
Thus the program as been successfully completed & executed.
Exercise :10

Create an application using the form controls and perform all


validation operations

AIM:
To validate a bio-data application form.

PROGRAM:
Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button1.Click

ListBox1.Items.Add("No : " + TextBox1.Text)


ListBox1.Items.Add("Name : " + TextBox2.Text)
ListBox1.Items.Add("Qualifications : " + TextBox3.Text)
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button2.Click
End
End Sub

Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If Not IsNumeric(e.KeyChar) Then
MsgBox("This is not a number ", MsgBoxStyle.Critical)
e.KeyChar = Nothing
End If
End Sub

Private Sub TextBox2_KeyPress(ByVal sender As Object, ByVal e As


System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
If IsNumeric(e.KeyChar) Then
MsgBox("This is not a character ", MsgBoxStyle.Critical)
e.KeyChar = Nothing
End If
End Sub
Private Sub TextBox3_KeyPress(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles TextBox4.KeyPress
If IsNumeric(e.KeyChar) Then
MsgBox("This is not a character ", MsgBoxStyle.Critical)
e.KeyChar = Nothing
End If
End Sub
End Class

INPUT&OUTPUT:
RESULT:
Thus the program has been successfully completed & executed.
Exercise 11:

Develop a program which makes use of String and String Builder class

AIM:

To Develop a program which makes use of String and String Builder class.

PROGRAM:
Console Application
Imports System.Text
Module Module1

Sub Main()

'Append and Appendline


Console.WriteLine("String Builder")
Console.WriteLine("==============")
Dim builder AsNew Text.StringBuilder
builder.Append("Fruits:")
builder.AppendLine()
builder.Append("Apple").AppendLine()
builder.Append("Orange").AppendLine()
builder.Append("Mango").AppendLine()
builder.Append("Banana").AppendLine()
builder.Append("Cherry").AppendLine()
Dim s AsString = builder.ToString
Console.WriteLine(s)

'Replace
Dim builder1 AsNew Text.StringBuilder("Initialize the StringBuilder.")
builder1.Replace("the", "my")
Console.WriteLine(builder1.ToString)

Dim vegetables AsString() = NewString() {"Tomato", "Carrot", "Brinjal"}


Dim builder2 As Text.StringBuilder = New Text.StringBuilder("The Vegetables
are Fresh:").AppendLine
Dim item AsString
ForEach item In vegetables
builder2.Append(item).AppendLine()
Next
Console.WriteLine(builder2.ToString)

'insert
Dim builder3 As Text.StringBuilder = New Text.StringBuilder("A cat")
Console.WriteLine(builder3)
builder3.Insert(1, " Fox")
Console.WriteLine(builder3)

'remove
builder3.Remove(5, 3)
Console.WriteLine(builder3)
Console.WriteLine("String")
Console.WriteLine("======")
'concatenate
Dim str1 AsString = "Visual"
Dim str2 AsString = "Basic .NET Programming"
Dim strres AsString = String.Concat(str1, str2)
Console.WriteLine(strres)

'copy
Dim strcopy AsString = String.Copy(strres)
Console.WriteLine(strcopy)

'uppercase and lowercase


Dim strupr AsString = "visual basic .net programming"
Console.WriteLine("Uppercase:" + strupr.ToUpper())

Dim strlwr AsString = String.Copy(strupr)


Console.WriteLine("Uppercase:" + strupr.ToLower)

Console.ReadLine()
EndSub
EndModule

INPUT&OUTPUT:
RESULT:
Thus the program has been successfully completed & executed.
Exercise 12:

CREATE A TEXTPAD APPLICATION


AIM:
To create a Text pad Application.

PROGRAM:
Public Class Form1
Dim str, txt As String

Private Sub Newfile_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles NewToolStripMenuItem.Click
RichTextBox1.Text = ""
End Sub

Private Sub Open_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles OpenToolStripMenuItem.Click
OpenFileDialog1.ShowDialog()
str = OpenFileDialog1.FileName
txt = My.Computer.FileSystem.ReadAllText(str)
RichTextBox1.Text = txt
End Sub

Private Sub Save_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles SaveToolStripMenuItem.Click
SaveFileDialog1.ShowDialog()
str = SaveFileDialog1.FileName
txt = RichTextBox1.Text
My.Computer.FileSystem.WriteAllText(str, txt, False)
End Sub

Private Sub Exitfile_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles ExitToolStripMenuItem.Click
End
End Sub

Private Sub Undo_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles UndoToolStripMenuItem.Click
Dim ud As RichTextBox = Me.ActiveControl
ud.Undo()
End Sub

Private Sub Cut_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles CutToolStripMenuItem.Click
Dim ct As RichTextBox = Me.ActiveControl
ct.Cut()
End Sub

Private Sub Copy_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles CopyToolStripMenuItem.Click
Dim cp As RichTextBox = Me.ActiveControl
cp.Copy()
End Sub

Private Sub Paste_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles PasteToolStripMenuItem.Click
Dim ps As RichTextBox = Me.ActiveControl
ps.Paste()
End Sub

Private Sub Selectall_Click(ByVal sender As System.Object, ByVal e As


System.EventArgs) Handles ToolStripButton1.Click
Dim sel As RichTextBox = Me.ActiveControl
sel.SelectAll()
End Sub

End Class
OUTPUT:

RESULT:
Thus the program has been successfully completed & executed.
Exercise 13:

Develop a VB.NET application using menu

AIM:
To develop a VB.NET application using menu

PROGRAM:
PublicClassForm1

PrivateSubNewToolStripMenuItem_Click(sender AsSystem.Object, e AsSystem.EventArgs)


HandlesNewToolStripMenuItem.Click
DimnewchildAsNewForm
newchild.MdiParent = Me
newchild.Text = "child form" + Me.MdiChildren.Length.ToString
newchild.Show()
EndSub

PrivateSubCloseToolStripMenuItem_Click(sender AsSystem.Object, e AsSystem.EventArgs)


HandlesCloseToolStripMenuItem.Click
Dimactvchild = Me.ActiveMdiChild
actvchild.Close()
EndSub

PrivateSubHorizantalToolStripMenuItem_Click(sender AsSystem.Object, e
AsSystem.EventArgs) HandlesHorizantalToolStripMenuItem.Click
Me.LayoutMdi(MdiLayout.TileHorizontal)
EndSub

PrivateSubVerticalToolStripMenuItem_Click(sender AsSystem.Object, e
AsSystem.EventArgs) HandlesVerticalToolStripMenuItem.Click
Me.LayoutMdi(MdiLayout.TileVertical)
EndSub

PrivateSubArrangeIconsToolStripMenuItem_Click(sender AsSystem.Object, e
AsSystem.EventArgs) HandlesArrangeIconsToolStripMenuItem.Click
Me.LayoutMdi(MdiLayout.ArrangeIcons)
EndSub
EndClass

INPUT&OUTPUT:
RESULT:
Thus the program has been successfully completed & executed.
Exercise 14:

Create an application using Common Dialog Controls

AIM:
To Create an application using Common Dialog Controls.

PROGRAM:

PublicClassForm1

PrivateSub CheckBox1_CheckedChanged(ByVal sender AsSystem.Object, ByVal e


AsSystem.EventArgs) Handles CheckBox1.CheckedChanged
PageSetupDialog1.Document = PrintDocument1
PageSetupDialog1.Document.DefaultPageSettings.Color = False
PageSetupDialog1.ShowDialog()
EndSub

PrivateSub CheckBox2_CheckedChanged(ByVal sender AsSystem.Object, ByVal e


AsSystem.EventArgs) Handles CheckBox2.CheckedChanged
If FontDialog1.ShowDialog <>Windows.Forms.DialogResult.CancelThen
RichTextBox1.ForeColor = FontDialog1.Color
RichTextBox1.Font = FontDialog1.Font
EndIf
EndSub

PrivateSub CheckBox4_CheckedChanged(ByVal sender AsSystem.Object, ByVal e


AsSystem.EventArgs) Handles CheckBox4.CheckedChanged
If ColorDialog1.ShowDialog <>Windows.Forms.DialogResult.CancelThen
Label1.ForeColor = ColorDialog1.Color
EndIf
EndSub

PrivateSub CheckBox3_CheckedChanged(ByVal sender AsSystem.Object, ByVal e


AsSystem.EventArgs) Handles CheckBox3.CheckedChanged
If OpenFileDialog1.ShowDialog <>Windows.Forms.DialogResult.CancelThen
PictureBox1.Image = Image.FromFile(OpenFileDialog1.FileName)
EndIf
EndSub

EndClass
OUTPUT:
Page setup

Color
Font Dialog

Open File

RESULT:
Thus the program has been successfully completed & executed.
Exercise 15:

Database Driven Application to Manage Employee Database


AIM:

To create a database driven application to manage employee database.

PROGRAM:

 Go to Start open SQL server 2005


 Select SQL server connection
 Click new query
 Create a database with five field(id,name,dept,date of joining,salary)
 Create database student
 Select the query &execute.
 Create table emp (emp id int, empnamevarchar, empdeptvarchar,empdateof joining
date, salary numbers)
 Select the query &execute
 Insert into emp values(1,’arun’,HR,02-Jan-2011,35000)
 Insert into emp values(2,’arjun’,Developer,15-Jul-2013,25000)
 Insert into emp values(3,’nived’,Tester,23-Dec-2015,30000)
 Select each query &execute
 Minimize the SQL server 2005 window
 Open visual studio 2008 filenewprojectwindow application ok
 Click the datagridview from the toolbar
 A window will be opened, click the combobox, select add datasource
 Database connection window will be opened.
 Click on the “new connection”option,select the server name or number from the
combobox.
 Select authentication: login name-sa password-sasa
 Select the database, click test connection.”Test Connection Succeeded” will be
displayed on the screen if the connection is established successfully.
 Click on the Debug button. The Database would be displayed in the driven application
to manage employee database in the Application Form.

INPUT&OUTPUT:
RESULT:
Thus the program has been successfully completed & executed.

You might also like