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

VB.NET Final Record (Autosaved)

The document is a practical record note for students of the Computer Applications Department at SRM Institute of Science and Technology, detailing various programming experiments conducted during the academic year 2023-2024. It includes aims, algorithms, form designs, and sample programs for tasks such as arithmetic calculations, area calculations using method overloading, student marksheets, shopping carts, digital clocks, sorting numbers, and calculators. Each experiment is structured with a clear aim, step-by-step algorithm, and corresponding Visual Basic .NET code.

Uploaded by

sabarish.0014
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)
10 views

VB.NET Final Record (Autosaved)

The document is a practical record note for students of the Computer Applications Department at SRM Institute of Science and Technology, detailing various programming experiments conducted during the academic year 2023-2024. It includes aims, algorithms, form designs, and sample programs for tasks such as arithmetic calculations, area calculations using method overloading, student marksheets, shopping carts, digital clocks, sorting numbers, and calculators. Each experiment is structured with a clear aim, step-by-step algorithm, and corresponding Visual Basic .NET code.

Uploaded by

sabarish.0014
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/ 41

SRM INSTITUTE OF SCIENCE AND TECHNOLOGY

FACULTY OF SCIENCE AND HUMANITIES


DEPARTMENT OF COMPUTER APPLICATIONS

PRACTICAL RECORD NOTE

STUDENT NAME :
REGISTER
:
NUMBER

CLASS : SECTION :

YEAR &
:
SEMESTER

SUBJECT CODE :

SUBJECT TITLE :

APRIL 2024
SRM INSTITUTE OF SCIENCE AND TECHNOLOGY
FACULTY OF SCIENCE AND HUMANITIES
DEPARTMENT OF COMPUTER APPLICATIONS
SRM Nagar, Kattankulathur – 603 203
CERTIFICATE

Certified to be the bonafide record of practical work done by

Register No. of Degree course for

UCA20401J – WINDOWS PROGRAMMING USING VB.NET in the Computer lab in

SRM Institute of Science and Technology during the academic year 2023-2024.

Staff In-charge Head of the Department

Submitted for Semester Practical Examination held on _.

Internal Examiner External Examiner


INDEX

SR. TITLE OF THE EXPERIMENT PAGE DATE STAFF


NO. SIGN.
01 ARITHMETIC CALCULATION

02 CALCUATION OF AREA USING METHOD


OVERLOADING
03 STUDENT MARKSHEET

04 SHOPPING CART

05 DIGITAL CLOCK

06 SORTING THE NUMBERS

07 CALCULATORS

08 GRAPHICS

09 ANIMATION

10 SLIDESHOW

11 STRING HANDLING FUNCTION

12 FILE HANDLING FUNCTION

13 CHANGING BACKGROUND COLOR OF


THE FORM
14 MENU TOOL STRIP

15 DATABASE CONNECTIVITY
Arithmetic Calculation
AIM:-To create a form for Arithmetic Calculation

ALGORITHM:-

STEP-1- Start the program.

STEP-2- Read the value of “a” and “b”.

STEP-3- Perform c=a+b and print the result.

STEP-4- Perform c=a-b and print the result.

STEP-5- Perform c=a*b and print the result.

STEP-6- Perform c=a/b and print the result.

STEP-7- Stop the program.

FORM DESIGN:-
PROGRAM:-

Public Class Form1


Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
sum.Text = Val(t1.Text) - Val(t2.Text)
End Sub

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


sum.Text = Val(t1.Text) * Val(t2.Text)
End Sub

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


sum.Text = Val(t1.Text) / Val(t2.Text)
End Sub

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


sum.Text = Val(t1.Text) + Val(t2.Text)
End Sub

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


t1.Text = ""
t2.Text = ""
sum.Text = ""
End Sub
End Class

OUTPUT:-

RESULT:-
Calculation of area using method overloading

AIM:- To create a form for Calculation of area using method overloading

ALGORITHM:-

STEP-1- Start the program.

STEP-2- Read the value of textbox1 and textbox2.

STEP-3- Rectangle button to perform Textbox3= Textbox1*Textbox2 and print the result.

STEP-4- Square button to perform Textbox3=Textbox1*Textbox1 and print the result.

STEP-5- Circle button to perform Textbox3=3.14* Textbox1*Textbox1and print the result.

STEP-6- Result Button to print the total.

STEP-7- Stop the program.

FORM DESIGN:-
PROGRAM:-

Public Class Form1


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
BackColor = Color.Aqua
Label1.Text = "LENGTH"
Label1.Visible = True
Label2.Visible = True
TextBox1.Visible = True
TextBox2.Visible = True

End Sub

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


BackColor = Color.Purple
Label1.Text = "SIDE"
Label1.Visible = True
Label2.Visible = False
TextBox1.Visible = True
TextBox2.Visible = False

End Sub

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


BackColor = Color.LightSkyBlue
Label1.Text = "RADIUS"
Label1.Visible = True
Label2.Visible = False
TextBox1.Visible = True
TextBox2.Visible = False
End Sub

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


If Label1.Text = "LENGTH" Then
TextBox3.Text = Val(TextBox1.Text) * Val(TextBox2.Text)
ElseIf Label1.Text = "SIDE" Then
TextBox3.Text = Val(TextBox1.Text) * Val(TextBox1.Text)
ElseIf Label1.Text = "RADIUS" Then
TextBox3.Text = 3.14 * Val(TextBox1.Text) * Val(TextBox1.Text)

End If
End Sub
End Class
OUTPUT:-

RESULT:-
Student Marksheet

AIM:- To create a form for Student Marksheet

ALGORITHM:-

STEP-1- Start the program.

STEP-2- Add text boxes for the required details of the student.

STEP-3- Add textboxes to enter the student marks in the corresponding subjects.

STEP-4- Add a button as result and write the code for the following step5 to step7 .

STEP-5- Add a textbox for total and write the code to calculate the total mark of all
the subjects as total=s1+s2+s3+s4+s5.

STEP-6- Add a textbox for percentage and write the code to calculate the percentage for
the total mark as percentage =total/5.

STEP-7- Add a textbox for grade and write the code to calculate the grade for the
particular mark using conditional statements.

STEP-8- Stop the program.

FORM DESIGN:-
PROGRAM:-

Public Class Form1


Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
total.Text = Val(s1.Text) + Val(s2.Text) + Val(s3.Text) + Val(s4.Text) + Val(s5.Text)
percentage.Text = Val(total.Text) / 5
If Val(percentage.Text) > 90 Then
grade.Text = "O"
ElseIf Val(percentage.Text) > 80 Then
grade.Text = "A+"
ElseIf Val(percentage.Text) > 70 Then
grade.Text = "A"
ElseIf Val(percentage.Text) > 60 Then
grade.Text = "B+"
ElseIf Val(percentage.Text) > 50 Then
grade.Text = "B"
ElseIf Val(percentage.Text) > 40 Then
grade.Text = "PASS"
Else
grade.Text = "FAIL"
End If
End Sub
Private Sub TextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles
TextBox1.KeyPress
If Asc(e.KeyChar) < 48 Or Asc(e.KeyChar) > 57 Then
e.Handled = True
MessageBox.Show("Only Number")
End If
End Sub
End Class

OUTPUT:-

RESULT:-
Shopping Cart

AIM:- To create a form for Shopping Cart

ALGORITHM:-

STEP-1- Start the program.

STEP-2- Create a combobox and add the items that are to be displayed.

STEP-3- Create a listbox to display the selected items.

STEP-4- Add two textbox to display the price of the items and the quantity.

STEP-5- Add a button to calculate the total price.

STEP-6- Stop the program.

PROGRAM:-

Public Class Form4


Dim q, r, t As Integer
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
q = CInt(TextBox1.Text)
r = CInt(TextBox2.Text)
t += (q * r)
MsgBox(t)
End Sub

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


ComboBox1.SelectedIndexChanged
ListBox1.Items.Add(ComboBox1.SelectedItem)
End Sub
End Class
OUTPUT:-

RESULT:-
Digital Clock

AIM:- To create a form for Digital Clock

ALGORITHM:-

STEP-1- Start the program.

STEP-2- Add a Timer from the toolbox.

STEP-3- Write the code to display current time.

STEP-4- Specify the timer display with Hours, Minutes and Seconds.

STEP-5- Stop the program.

FORM DESIGN:-
PROGRAM:-

Public Class Form2

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


Dim hh As Integer = DateTime.Now.Hour
Dim mm As Integer = DateTime.Now.Minute
Dim ss As Integer = DateTime.Now.Second
Dim x As String
Dim time As String = ""
If (hh < 10) Then
time &= "0" + hh
Else
time &= hh
End If
time &= ":"
If (mm < 10) Then
time &= "0" + mm
Else
time &= mm
End If
time &= ":"
If (ss < 10) Then
time &= "0" + ss
Else
time &= ss
End If
If (hh > 12)
Then x =
"PM"
Else
x = "AM"
End If
Label1.Text = time & "" &
x End Sub

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


Timer1.Start()

End Sub
End Class
OUTPUT:-

RESULT:-
Sorting The Numbers

AIM:- To create a form for Sorting The Numbers

ALGORITHM:-

STEP-1- Start the program.

STEP-2- Add listbox to display the unsorted list of numbers

STEP-3- Add a button SORTING and write the code to display the sorted numbers in the
listbox.

STEP-4- Write the code using For loop to sort the numbers in ascending or descending order.

STEP-5- Stop the program.

FORM DESIGN:-
PROGRAM:-

Module Module1
Dim arr As Integer() = New Integer(5) {}
Public Sub getval()
Dim i As Integer
Dim j As Integer
Dim temp As Integer = 0
Form1.ListBox1.Items.Add("Array elements are")
For i = 0 To 4 Step 1
arr(i) = Val(InputBox("enter the value"))
Form1.ListBox1.Items.Add(arr(i))

Next
End Sub
Public Sub Sort_asc()
Dim i As Integer
Dim j As Integer
Dim temp As Integer
For i = 0 To 4 Step 1
For j = 4 To i + 1 Step -1
If (arr(j) < arr(j - 1)) Then
temp = arr(j)
arr(j) = arr(j - 1)
arr(j - 1) = temp

End If
Next
Next
Form1.ListBox1.Items.Add("ASc ordered values")
For i = 0 To 4 Step 1
Form1.ListBox1.Items.Add(arr(i))
Next
End Sub
Public Sub Sort_dsc()
Dim i As Integer
Dim j As Integer
Dim temp As Integer
For i = 0 To 4 Step 1
For j = 4 To i + 1 Step -1
If (arr(j) > arr(j - 1)) Then
temp = arr(j)
arr(j) = arr(j - 1)
arr(j - 1) = temp

End If
Next
Next

Form1.ListBox1.Items.Add("DSC ordered values")


For i = 0 To 4 Step 1
Form1.ListBox1.Items.Add(arr(i))

Next
End Sub
End Module
Public Class Form1

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


Button1.Click
Dim s As String
s = InputBox("Do you want sort in ASC or DSC")
Call getval()
If s = "ASC" Then
Call Sort_asc()
Else
Call Sort_dsc()

End If

End Sub

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


Handles ListBox1.SelectedIndexChanged

End Sub
End Class

OUTPUT:-

RESULT:-
Calculator

AIM:- To create a form for Calculator

ALGORITHM:-

STEP-1- Start the program.

STEP-2- Using the button tool to add the buttons for the integer from 0 to 9 and other
operation’s.

STEP-3- Add separate buttons for addition, subtract, multiplication, and divide and write
the code for the respective operations.

STEP-4- Add textbox that displays the values in the buttons when clicked.

STEP-5- When the buttons are clicked the respective actions will be performed during
the executions of code.

STEP-6- Result will be displayed in the textbox.

STEP-7- Stop the program.

FORM DESIGN:-
PROGRAM:-

Public Class Form1


Dim op As String
Dim n1, n2, total As Double
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
TextBox1.Text = TextBox1.Text & 1
End Sub

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


TextBox1.Text = TextBox1.Text & 2
End Sub

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


TextBox1.Text = TextBox1.Text & 3
End Sub

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


TextBox1.Text = TextBox1.Text & 4
End Sub

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


TextBox1.Text = TextBox1.Text & 5
End Sub

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


TextBox1.Text = TextBox1.Text & 6
End Sub

Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click


TextBox1.Text = TextBox1.Text & 7
End Sub

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


TextBox1.Text = TextBox1.Text & 8
End Sub

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


TextBox1.Text = TextBox1.Text & 9
End Sub

Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click


If Not TextBox1.Text.Contains(".") Then
TextBox1.Text = TextBox1.Text & "."
End If
End Sub

Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click


TextBox1.Clear()
End Sub

Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click


If TextBox1.TextLength > 0 Then
Dim s As String
s = TextBox1.Text
TextBox1.Text = s.Substring(0, s.Length - 1)
End If
End Sub

Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click


n1 = Val(TextBox1.Text)
op = "+"
TextBox1.Clear()

End Sub

Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click


TextBox1.Text = TextBox1.Text & 0
End Sub

Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click


n1 = Val(TextBox1.Text)
op = "-"
TextBox1.Clear()
End Sub

Private Sub Button16_Click(sender As Object, e As EventArgs) Handles Button16.Click


n1 = Val(TextBox1.Text)
op = "*"
TextBox1.Clear()
End Sub

Private Sub Button17_Click(sender As Object, e As EventArgs) Handles Button17.Click


n1 = Val(TextBox1.Text)
op = "/"
TextBox1.Clear()
End Sub

Private Sub Button18_Click(sender As Object, e As EventArgs) Handles Button18.Click


n2 = Val(TextBox1.Text)
Select Case op
Case "+"
total = n1 + n2
Case "-"
total = n1 - n2
Case "*"
total = n1 * n2
Case "/"
total = n1 / n2

End Select
TextBox1.Text = total
End Sub
End Class
OUTPUT:-

RESULT:-
Graphics

AIM:- To create a form for Graphics

ALGORITHM:-

STEP-1- Start the program.

STEP-2- Open the Form1 design and double click the form1.vb to generate the codeing part.

STEP-3- Inside the coding part instantiate a Graphics object using Me.CreateGraphics().

STEP-4- Define the pen and colors using the color structure.

STEP-5- Draw lines using, ellipses, and rectangles on the form using the DrawLine,
DrawEllipse, and FillRectangle methods of the Graphics object.

STEP-6- Create an array of point objects to define the points for drawing curves, then use
the DrawCurve method to draw curves on the form.

STEP-7- Stop the program.

PROGRAM:-

Public Class Form1

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


System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim GraphicsFun As Graphics
GraphicsFun = Me.CreateGraphics
Dim pencolor As New Pen(Color.Red)
GraphicsFun.DrawLine(pencolor, 20, 30, 100, 80)
GraphicsFun.DrawEllipse(pencolor, 30, 288, 400, 37)
Dim brushcolor As New SolidBrush(Color.Green)
GraphicsFun.FillRectangle(brushcolor, 140, 25, 200, 600)
Dim points() As Point = {New Point(564, 300), New Point(300, 320), New Point(270, 155),
New Point(350, 190)}
For tension As Single = 0 To 2.5 Step 0.5
GraphicsFun.DrawCurve(Pens.DodgerBlue, points, tension)
Next
End Sub
End Class
OUTPUT:-

RESULT:-
Animation

AIM:- To create a form for Animation

ALGORITHM:-

STEP-1- Start the program.

STEP-2- Add two buttons a picturebox and a timer.

STEP-3- In button1 write the code and set GoingUp to Ture and enable timer.

STEP-4- In button2 write the code and set GoingUp to False and enable timer.

STEP-5- In timer move the picturebox up if Goingup is true or down if Goingup is false.

STEP-6- Stop the program.

FORM DESIGN:-
PROGRAM:-

Public Class Form1


Dim GoingUp As Boolean
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button1.Click
GoingUp = True
Timer1.Enabled = True
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
Button2.Click
GoingUp = False
Timer1.Enabled = True
End Sub

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


Timer1.Tick
If GoingUp = True Then
'move picture box toward the top'
If PictureBox1.Top > 10 Then
PictureBox1.Location = New Point(PictureBox1.Location.X - 10, PictureBox1.Location.Y - 10)
End If
Else
'move picture box toward the bottom'
If PictureBox1.Top < (Me.Size.Height - 75) Then
PictureBox1.Location = New Point(PictureBox1.Location.X + 10,
PictureBox1.Location.Y + 10)

End If
End If
End Sub
End Class

OUTPUT:-

RESULT:-
Slide Show

AIM:- To create a form for Slide Show

ALGORITHM:-

STEP-1- Start the program.

STEP-2- Add a CheckBox , a PictureBox , and four Buttons to the form.

STEP-3- In checkbox1, enable the Timer with an interval of 100 milliseconds when the checkbox is
checked, otherwise disable the Timer .

STEP-4- In Timer1 , cycle through images in the imgaelist control by updating the
pictureboxlist with the next image in the list.

STEP-5- In Button1, set the pictuerebox.image to the first image in theimagelist1control.

STEP-6- Inside the button2,button3,button4 event handlers, update the PictureBox1.Image


with the next or previous image in the ImageList1 control, cycling through the
images accordingly.

STEP-7- Stop the program.

FORM DESIGN:-
PROGRAM:-

Public Class Form1


Dim index As Integer

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


System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
Timer1.Enabled = True
Timer1.Interval = 100
Else
Timer1.Enabled = False
End If
End Sub

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


index = (index + 1) Mod ImageList1.Images.Count
PictureBox1.Image = ImageList1.Images(index)
End Sub

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


index = (index + 1) Mod ImageList1.Images.Count
PictureBox1.Image = ImageList1.Images(index)
End Sub

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


If index = 0 Then
index = ImageList1.Images.Count - 1
Else
index = index - 1
End If
PictureBox1.Image = ImageList1.Images(index)
End Sub

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


Dim c As Integer = ImageList1.Images.Count - 1
PictureBox1.Image = ImageList1.Images(c)
End Sub

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


PictureBox1.Image = ImageList1.Images(0)
End Sub
End Class
OUTPUT:-

RESULT:-
String Handling Function

AIM:- To create a form for String Handling Function

ALGORITHM:-

STEP-1- Start the program.

STEP-2- Use a listbox for creating a list of options lie, Concatenation, Comparison,
Length, Uppercase, Lowercase, Reverse, Substring

STEP-3- Write the code that pperforms the particular task as per the selected keyword from
the listbox.

STEP-4- Select the option from the listbox and the input message box will be displayed.

STEP-5- Inside the input message box give the input and the result will be displayed in the
textbox.

STEP-6- Stop the program.

FORM DESIGN:-
PROGRAM:-
Public Class Form1
Dim A, B, P1, P2 As String
Dim n As Integer

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


ListBox1.Items.Add("concatenation")
ListBox1.Items.Add("comparison")
ListBox1.Items.Add("length of string")
ListBox1.Items.Add("substring")
ListBox1.Items.Add("uppercase")
ListBox1.Items.Add("lowercase")
ListBox1.Items.Add("reverse")
End Sub

Private Sub ListBox1_Click(sender As Object, e As EventArgs) Handles ListBox1.Click


n = ListBox1.SelectedIndex
Select Case n
Case 0
A = InputBox("ENTER THE FIRST STRING")
B = InputBox("ENTER THE SECOND STRING")
TextBox1.Text = Trim(A) + Trim(B)

Case 1
A = InputBox("ENTER THE FIRST STRING")
B = InputBox("ENTER THE SECOND STRING")
Dim c As Integer = StrComp(A, B)
If c = 0 Then
MessageBox.Show("BOTH ARE EQUAL")
Else
MessageBox.Show("BOTH ARE NOT EQUAL")
End If

Case 2
A = InputBox("ENTER THE STRING")
TextBox1.Text = Len(A)

Case 3
A = InputBox("ENTER THE STRING")
P1 = InputBox("ENTER THE STARTING POSITION")
P2 = InputBox("ENTER THE NUMBER OF CHARACTERS")
TextBox1.Text = Mid(A, P1, P2)

Case 4
A = InputBox("ENTER THE STRING")
TextBox1.Text = A.ToUpper()

Case 5
A = InputBox("ENTER THE STRING")
TextBox1.Text = A.ToLower()

Case 6
A = InputBox("ENTER THE STRING")
TextBox1.Text = StrReverse(A)
End Select
End Sub
End Class
OUTPUT:-

RESULT:-
File Handling Function

AIM:- To create a form for File Handling Function

ALGORITHM:-

STEP-1- Start the program.

STEP-2- Add a Button1 in that write an array of bytes {65, 66, 67, 68, 69} to the file using
WriteByte method.

STEP-3- Add a Button2 which will be used to read the bytes from the files using
ReadBytes method until the file reaches the end, converts the byte array to a string
using System.Text.Encoding.ASCII.GetString and displays it in a message box.

STEP-4- Add Button3 which will be used to create the FileInfo when clicked, retrieves and
displays various properties of the file such as name, full name, size, and last write
time in a ListBox.

STEP-5- Stop the program.

FORM DESIGN:-
PROGRAM:-

Imports System.IO
Public Class Form1

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


Button1.Click
Dim fs As New FileStream("test1.txt", FileMode.Create, FileAccess.Write)
Dim bytes() As Byte = {65, 66, 67, 68, 69}
For Each i As Byte In bytes
fs.WriteByte(i)

Next
fs.Close()
MsgBox("file created")

End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim fs1 As New FileStream("test1.txt", FileMode.Open, FileAccess.Read)
Dim j As Integer
Dim pos As Integer = 0
Dim arr(10) As Byte
Do
j = fs1.ReadByte
If j <> -1 Then
arr(pos) = CByte(j)
pos = pos + 1
End If
Loop While j <> -1
MessageBox.Show(System.Text.Encoding.ASCII.GetString(arr))
End Sub

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


Dim f As New FileInfo("test1.txt")
ListBox1.Items.Add(f.Name)

ListBox1.Items.Add(f.FullName)
ListBox1.Items.Add(f.Length())
ListBox1.Items.Add(f.LastWriteTime)

End Sub
End Class
OUTPUT:-

RESULT:-
Changing Background Color Of The Form
AIM:- To create a form for String Changing Background Color Of The Form

ALGORITHM:-

STEP-1- Start the program.

STEP-2- Add the required number of buttons as the number of colors

required. STEP-3- Click each buttons and write the code

Backcolor=Color.Colorname. STEP-4- Stop the program.

PROGRAM:-
Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
BackColor = Color.Blue
End Sub

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


BackColor = Color.Yellow
End Sub

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


BackColor = Color.Cyan
End Sub
End Class

OUTPUT:-

RESULT:-
Menu Tool Strip

AIM:- To create a form for Menu Tool Strip

ALGORITHM:-

STEP-1- Start the program.

STEP-2- Add a RichTextBox and MenuStrip onto the form.

STEP-3- Add "Edit" menu with "Paste" and "Select All" options and write the respect code
for the options to perform its operations.

STEP-4- Add "Format" menu with "Font" and "Color" options and add the font and color
tools from the toolbox.

STEP-5- Add the additional features that are required.

STEP-6- Stop the program.

FORM DESIGN:-
PROGRAM:-

Public Class Form1


Private Sub NewToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
NewToolStripMenuItem.Click
RichTextBox1.Clear()

End Sub

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


OpenToolStripMenuItem.Click
OpenFileDialog1.Filter = "text files |*.txt"
If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
RichTextBox1.LoadFile(OpenFileDialog1.FileName)
End If

End Sub

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


SaveToolStripMenuItem.Click
SaveFileDialog1.Filter = "text files|*.txt"
If (SaveFileDialog1.ShowDialog() = DialogResult.OK) Then

RichTextBox1.SaveFile(SaveFileDialog1.FileName)
End If
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 SelectAllToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles


SelectAllToolStripMenuItem.Click
RichTextBox1.SelectAll()
End Sub

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


FontToolStripMenuItem.Click
If FontDialog1.ShowDialog() = DialogResult.OK Then
RichTextBox1.SelectionFont = FontDialog1.Font
End If
End Sub
Private Sub ColorToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles
ColorToolStripMenuItem.Click
If ColorDialog1.ShowDialog() = DialogResult.OK Then
RichTextBox1.SelectionColor = ColorDialog1.Color
End If

End Sub
End Class.

OUTPUT:-

RESULT:-
Database Connectivity
AIM:- To create a form for Database Connectivity

ALGORITHM:-

STEP-1- Start the program.

STEP-2- Go to Database Connectivity Server.

STEP-3- Select "Project Data Source" and then "Add New Project Data Source".
Then, choose "Database".

STEP-4- Choose "Dataset" and then "New Collection" to bring up a new window.

STEP-5- Specify the version of SQL Server from this new box.

STEP-6- After connecting, select the required table first, then the database.

STEP-7- Your data will start to fill the grid. Press "Finish."

STEP-8- The data from your table will now be displayed in the grid when you execute
the programme.

STEP-9- Stop the program.

PROGRAM:-

Public Class Form1


Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.Table_1TableAdapter.Fill(Me.DB1DataSet.Table_1)
End Sub
End Class

OUTPUT:-

RESULT:-

You might also like