Sie sind auf Seite 1von 57

PONDICHERRY UNIVERSITY

(A CENTRAL UNIVERSITY) R.VENKATARAMAN NAGAR , KALAPET PUDUCHERRY -605014

SCHOOL OF ENGINEERING AND TECHNOLOGY


DEPARTMENT OF COMPUTER SCIENCE MASTER OF COMPUTER SCIENCE(M.Sc)

VISUAL BASIC LAB RECORD


NAME

REGISTER NUMBER SEMESTER YEAR SUBJECT

:. : :.. :
1

PONDICHERRY UNIVERSITY
(A CENTRAL UNIVERSITY) R.VENKATARAMAN NAGAR , KALAPET PUDUCHERRY -605014

SCHOOL OF ENGINEERING AND TECHNOLOGY


DEPARTMENT OF COMPUTER SCIENCE MASTER OF COMPUTER SCIENCE(M.Sc)

BONAFIDE CERTIFICATE
Certified that this is a bonafide record of practical work done by.. with register number . Of M.Sc in semester.. during the year..

Lecture In Charge
Submitted for the practical examination held on.at the department of Computer Science, Pondicherry University

Internal Examiner

External Examiner
2

INDEX EX.NO 1 DATE TITLE SCIENTIFIC CALCULATOR PAGE# 4 to 8 Signature

ANALOG CLOCK

9 to 11

WINDOWS EXPLORER

12 to 17

WORD PROCESSING TOOL KIT

18 to 24

PAINT

25 to 33

PROGRAM LAUNCHER

34 to 35

GRADING APPLICATION

36 to 45

ON SCREEN KEYBOARD

46 to 56

EXPERIMENT NUMBER 1 DATE: 22/08/2011 Create a windows based application to have the basic functionalities of a scientific calculator

PROBLEM DEFINITION:
A scientific calculator that has provisions for handling exponential, trigonometric, and sometimes other special functions in addition to performing arithmetic operations.

DESIGN OF SPECIFICATION: CONTROL


Textbox Buttons Buttons Buttons

NAME OF CONTROL
Textbox1 Button1 to button10 Button11 to button15 Button15 to button19

DESCRIPTION
Use to take input from user Use to input numbers from 0 to 9 Use to input arithmetic operators +,-,*,/,= Use to input trigonometric functions sine,cosine,tangent and logarithmic functions

SOURCE CODE:
Public Class Form1 Dim op As Integer Dim a As Double Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click inp.Text = String.Concat(inp.Text, 1) End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click inp.Text = String.Concat(inp.Text, 2) End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click inp.Text = String.Concat(inp.Text, 3) End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click inp.Text = String.Concat(inp.Text, 4) End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click inp.Text = String.Concat(inp.Text, 5) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click inp.Text = String.Concat(inp.Text, 6) End Sub Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click inp.Text = String.Concat(inp.Text, 7) End Sub Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click inp.Text = String.Concat(inp.Text, 8) End Sub Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click inp.Text = String.Concat(inp.Text, 9) End Sub Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click inp.Text = String.Concat(inp.Text, 0) End Sub Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click a = CDec(inp.Text) inp.Text = "" op = 1 End Sub Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click a = CDec(inp.Text) inp.Text = "" op = 2 End Sub

Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click a = CDec(inp.Text) inp.Text = "" op = 3 End Sub Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click a = CDec(inp.Text) inp.Text = "" op = 4 End Sub Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click If op = 1 Then inp.Text = a + CDec(inp.Text) ElseIf op = 2 Then inp.Text = a - CDec(inp.Text) ElseIf op = 3 Then inp.Text = a * CDec(inp.Text) ElseIf op = 4 Then inp.Text = a / CDec(inp.Text) End If End Sub Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click inp.Text = Math.Sin(CDec(inp.Text)) End Sub Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click inp.Text = Math.Cos(CDec(inp.Text)) End Sub Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button18.Click inp.Text = Math.Tan(CDec(inp.Text)) End Sub Private Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button19.Click inp.Text = Math.Log10(CDec(inp.Text)) End Sub Private Sub Button20_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

End Sub Private Sub Button20_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button20.Click inp.Text = Math.Sqrt(CDec(inp.Text)) End Sub Private Sub Button21_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button21.Click inp.Text = (1 / 100) * CDec(inp.Text) End Sub Private Sub Button22_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button22.Click inp.Text = 1 / CDec(inp.Text) End Sub Private Sub Button23_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button23.Click inp.Text = String.Concat(inp.Text, ".") End Sub Private Sub Button24_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button24.Click inp.Text = "" End Sub End Class

DEBUG CHART: Serial Error Name no.


1 2 InvalidCastException was unhandled InvalidCastException was unhandled

Error Location
Txtinp.text=temp + (txtinp.text) Math.log(txtinp.text)

Solution to Errors
Txtinp.text=temp + cInt(txtinp.text) Math.log(CDec(txtinp.text)

SCREEN SHOT:

RESULT: The above program has been executed and the output was verified successfully.

EXPERIMENT NUMBER 2 DESIGN AN ANALOG CLOCK DATE: 5/9/2011

PROBLEM DEFINITION:
To Design an Analog Clock using visual basic language . An analog clock is one that has a face, with 12 marks or numbers around its edge, and three hands one for the hour and one for the minutes and one for the second.

DESIGN OF SPECIFICATION: CONTROL


LABELS TIMER

NAME OF CONTROL
LABELS 1 to 12 TIMER1

DESCRIPTION
To display numbers in clock Drawing minute , hour and second hand Running the clock at certain intervals

TIMER

TIMER2

SOURCE CODE :SOURCE CODE: Public Class Form1 Dim tick As Integer = 270 Dim tick2 As Integer = 270 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub ToolStripContainer1_TopToolStripPanel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripContainer1.TopToolStripPanel.Click End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

Dim seconds As Integer = (Now.Second * 6) + 270 Dim minutes As Integer = (Now.Minute * 5) + 270 Dim hours As Integer = (Now.Hour * 30) + 270 time.Text = Now Dim g As Graphics g = Me.CreateGraphics Dim hour As New Pen(Color.Blue) Dim hour2 As New Pen(Color.White) Dim second As New Pen(Color.Red) Dim minute As New Pen(Color.Green) Dim minute2 As New Pen(Color.White) Dim white As New Pen(Color.White) Dim circle As New Pen(Color.White) hour.Width = 8 hour2.Width = 10 second.Width = 1 minute.Width = 4 minute2.Width = 10 circle.Width = 5 g.DrawPie(hour2, 319, 219, 240, 240, hours - 30, 360) g.DrawPie(minute2, 289, 189, 300, 300, minutes - 6, 360) g.DrawPie(Pens.White, 269, 169, 340, 340, seconds - 6, 360) g.DrawPie(hour, 319, 219, 240, 240, hours, 360) g.DrawEllipse(white, 319, 219, 240, 240) g.DrawPie(minute, 289, 189, 300, 300, minutes, 360) g.DrawEllipse(white, 289, 189, 300, 300) g.DrawPie(second, 269, 169, 340, 340, seconds, 360) g.DrawEllipse(white, 269, 169, 340, 340) g.DrawEllipse(circle, 249, 149, 380, 380) End Sub Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click End Sub Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick tick += 6 tick2 += 30 Dim g As Graphics Dim hoursmarks As New Pen(Color.Black) hoursmarks.Width = 5 g = Me.CreateGraphics g.DrawPie(Pens.Black, 249, 149, 380, 380, tick, 360) g.DrawPie(hoursmarks, 249, 149, 380, 380, tick2, 360) g.DrawEllipse(Pens.White, 269, 169, 340, 340) g.FillEllipse(Brushes.White, 269, 169, 340, 340) If tick > 800 Then Timer1.Stop() tick = 270 tick2 = 27 End If End Sub End Class

10

DEBUG CHART : Serial number


1

Error name
Time is not defined

Error Location Solution to the Errors


Line 7 Time.text=now

SCREEN SHOT:

RESULT:
The above program has been executed and the output was verified successfully.

11

EXPERIMENT NUMBER 3 DATE: 10/9/2011 DESIGN A WINDOWS APPLICATION TO MIMIC THE BASIC FUNCTIONALITIES OF WINDOWS EXPLORER

PROBLEM DEFINITION:
Windows Explorer is an application that provides detailed information about your files, folders, and drives. we can use it to see how your files are organized and to copy, move, and rename files, as well as perform other tasks pertaining to files, folders, and drives

DESIGN OF SPECIFICATION: CONTROLS


BROWSER DIRECTORY LIST BOX

NAME OF CONTROL
Browser1 Directory list box

DESCRIPTION
To navigate, refresg, stop,backward,froward To list out the directories inside the drives To list out the available drives To list out all the files inside the directory Inside frame all the listbox are kept To create menus for creating or removing directory Clicking on the buttons doing some action like stop,refresh etc For Showing the path and also to enter directory name to create or remove

DRIVE LIST BOX FILE LIST BOX FRAME MENU EDITOR BUTTONS TEXTBOX

Drive list box File list box Frame1 Menu editor Button 1 to 3 Textbox 1 to 3

12

SOURCE CODE :FORM1 Private Sub Command1_Click(Index As Integer) WebBrowser1.GoBack Text1.Text = Drivelistbox.Drive + Directorylistbox.Path + File1.Path End Sub Private Sub Command2_Click() WebBrowser1.GoForward Text1.Text = Drivelistbox.Drive + Directorylistbox.Path + File1.Path End Sub Private Sub Command3_Click() WebBrowser1.Stop Text1.Text = Drivelistbox.Drive + Directorylistbox.Path + File1.Path End Sub Private Sub Command4_Click() WebBrowser1.Refresh Text1.Text = Drivelistbox.Drive + Directorylistbox.Path + File1.Path End Sub Private Sub deletemnu_Click() Form3.Show Text1.Text = Drivelistbox.Drive + Directorylistbox.Path + File1.Path End Sub FORM2 Private Sub Command1_Click() MkDir (Text1.Text) Unload Me Form1.Show 13

End Sub Private Sub Command2_Click() Unload Me Form1.Show End Sub Private Sub Form_Load() List1.Clear List1.AddItem ("c:\") List1.AddItem ("D:\") List1.AddItem ("H:\") Form1.Width = 9175 Form1.Top = 800 End Sub

Private Sub List1_Click() 'List1.Clear 'List1.AddItem ("c:\") 'List1.AddItem ("D:\") 'List1.AddItem ("H:\") Text1.Text = List1.Text End Sub FORM 3 Private Sub Command1_Click() RmDir (Text1.Text) Unload Me Form1.Show End Sub 14

Private Sub Command2_Click() Unload Me Form1.Show End Sub Private Sub Form_Load() List1.Clear List1.AddItem ("C:\") List1.AddItem ("D:\") List1.AddItem ("h:\") Form1.Width = 9175 Form1.Top = 800 End Sub Private Sub List1_Click() Text1.Text = List1.Text

End Sub

DEBUG CHART : Serial number


1 2 3

Error name
Type mismatch Argument not optional 2147467259

Error Location Solution to the Errors


Line 13 Compile error Run time error Webbrowser1.go back Webbrowser1.navigate Webbrowser1.GoForward

15

SCREEN SHOT :

16

RESULT : The above program has been executed and the output was verified successfully

17

EXPERIMENT NUMBER 4 DATE:10.10.2011

DESIGN AND IMPLEMENT A SIMPLE WORD PROCESSING TOOL KIT

PROBLEM DEFINITION:
Notepad is a basic text editor that is embedded in Microsoft Windows. We can create text file of .txt and .rtf extension.

DESIGN OF SPECIFICATION: CONTROL


MENU EDITOR RICH TEXTBOX COMMON DIALOGBOX

NAME OF CONTROL
Menu editor RichTextbox1 Common dialog1

DESCRIPTION
For Creating menu bar For selecting text, font style,font color etc For file open,file close,show font etc

SOURCE CODE:
Dim saveflag As Boolean Dim a As String Private Sub newmnu_Click() Dim a As Integer If RichTextBox1.Text <> " " Then a = MsgBox("you wanna save this file", vbYesNoCancel + vbQuestion, "save") If a = vbYes Then CommonDialog1.Filter = "text files(*.txt,*.rtf)|*.txt;*rtf| All Files (*.*)|*.*" CommonDialog1.ShowSave RichTextBox1.savefile (CommonDialog1.FileName) RichTextBox1.Text = "" End If If a = vbNo Then 18

RichTextBox1.Text = "" End If End If End Sub Private Sub openmnu_Click() Dim a As Boolean If RichTextBox1.Text <> "" Then a = MsgBox("you wanna save this file", vbYesNoCancel + vbQuestion, "save") If a = vbYes Then CommonDialog1.Filter = "text files(*.txt,*.rtf)|*.txt;*rtf| All Files (*.*)|*.*" CommonDialog1.ShowSave RichTextBox1.savefile (CommonDialog1.FileName) CommonDialog1.ShowOpen RichTextBox1.LoadFile (CommonDialog1.FileName) ElseIf a = vbNo Then CommonDialog1.Filter = "text files(*.txt,*.rtf)|*.txt;*rtf| All Files (*.*)|*.*" CommonDialog1.ShowOpen RichTextBox1.LoadFile (CommonDialog1.FileName) Else CommonDialog1.Filter = "text files(*.txt,*.rtf)|*.txt;*rtf| All Files (*.*)|*.*" CommonDialog1.ShowOpen RichTextBox1.LoadFile (CommonDialog1.FileName) End If End If End Sub Private Sub copyedit_Click() a = RichTextBox1.SelText 19

End Sub Private Sub aboutnotepadhelpmenu_Click() MsgBox "MR.ATKT+1 year sem backer's notepad_ refernce by vb6 black book,mastering vb 6, Ankit Grover's & wordpad and INTERNET ", vbInformation, "about notepad" End Sub Private Sub cutedit_Click() a = RichTextBox1.SelText RichTextBox1.SelText = "" End Sub Private Sub deletedit_Click() a = RichTextBox1.SelText RichTextBox1.SelText = "" End Sub Private Sub exitmnu_Click() End End Sub Private Sub findedit_Click() a = (InputBox("find what", Find)) RichTextBox1.Find (a) End Sub Private Sub formatfontcolor_Click() CommonDialog1.Flags = cdlCFBoth Or cdlCFEffects 'CommonDialog1.ShowFont CommonDialog1.ShowColor RichTextBox1.SelColor = CommonDialog1.Color End Sub Private Sub formatfontstyle_Click()

20

CommonDialog1.Flags = cdlCFBoth Or cdlCFEffects CommonDialog1.ShowFont RichTextBox1.SelFontName = CommonDialog1.FontName RichTextBox1.SelFontSize = CommonDialog1.FontSize End Sub Private Sub helptopicshelpmnu_Click() MsgBox "open vb6 black book, mastering vb6, open http://msdn.microsoft.com/enus/library/ms950408.aspx " End Sub Private Sub openfile_Click() Dim a As Boolean If RichTextBox1.Text <> "" Then a = MsgBox("you wanna save this file", vbYesNoCancel + vbQuestion, "save") If a = vbYes Then CommonDialog1.Filter = "text files(*.txt,*.rtf)|*.txt;*rtf| All Files (*.*)|*.*" CommonDialog1.ShowSave RichTextBox1.savefile (CommonDialog1.FileName) CommonDialog1.ShowOpen RichTextBox1.LoadFile (CommonDialog1.FileName) ElseIf a = vbNo Then CommonDialog1.Filter = "text files(*.txt,*.rtf)|*.txt;*rtf| All Files (*.*)|*.*" CommonDialog1.ShowOpen RichTextBox1.LoadFile (CommonDialog1.FileName) Else CommonDialog1.Filter = "text files(*.txt,*.rtf)|*.txt;*rtf| All Files (*.*)|*.*" CommonDialog1.ShowOpen RichTextBox1.LoadFile (CommonDialog1.FileName)

21

End If End If End Sub Private Sub pastedit_Click() RichTextBox1.SelText = a End Sub Private Sub printfile_Click() CommonDialog1.ShowPrinter End Sub Private Sub SaveAsfile_Click() CommonDialog1.Filter = "text files(*.txt,*.rtf)|*.txt;*rtf| All Files (*.*)|*.*" CommonDialog1.ShowSave RichTextBox1.savefile (CommonDialog1.FileName) End Sub Private Sub savefile_Click() CommonDialog1.Filter = "text files(*.txt,*.rtf)|*.txt;*rtf| All Files (*.*)|*.*" CommonDialog1.ShowSave RichTextBox1.savefile (CommonDialog1.FileName) End Sub Private Sub selectalledit_Click() RichTextBox1.SelStart = 0 RichTextBox1.SelLength = Len(RichTextBox1.Text) End Sub

Private Sub undoedit_Click() RichTextBox1.Text = a End Sub 22

DEBUG CHART: Serial Error Name no.


1 Block if without end if

Error Location
Compile error

Solution to Errors
Commondialog1.filename End if

SCREEN SHOT:

23

RESULT : The above program has been executed and the output was verified successfully.
24

EXPERIMENT NUMBER 5 DATE: 3/10/2011

TO DESIGN AND IMPLEMENT A SIMPLE IMAGE PROCESSING TOOLKIT USING VISULA BASIC

PROBLEM DEFINITION:
Paint is a drawing tool you can use to create simple or elaborate drawings. These drawings can be either black-and-white or color, and can be saved as bitmap files. You can print your drawing, use it for your desktop background, or paste it into another document. You can even use Paint to view and edit scanned photos. You can also use Paint to work with pictures, such as .jpg, .gif, or .bmp files. You can paste a Paint picture into another document you've created, or use it as your desktop background.

DESIGN OF SPECIFICATION: CONTROL


MENU EDITOR BUTTONS

NAME OF CONTROL
Menu1 BUTTON 1 to 5

DESCRIPTION
To create meny bar like file menu ,edit menu ,color etc Pressing buttons we will select drawing tools like pencil,eraser, brush To get color palette For drawing For drawing ovals in the picture box1

COMMON DIALOG BOX PICTURE BOX SHAPE

Commondialog1 Picturebox1 Oval Shape

SOURCE CODE:
Dim x As Variant Dim key As String Dim state As String Dim xf As Integer, yf As Integer Dim change As String Dim ctrl As Boolean

25

Private Sub abt_Click() frmabt.Show End Sub Private Sub brushcmd_Click() key = "brush" oval.Visible = True pencilcmd.Enabled = True brushcmd.Enabled = False eracecmd.Enabled = True linecmd.Enabled = True rbrushcmd.Enabled = True End Sub Private Sub clear_Click() pict.Cls linv.Visible = False End Sub Private Sub eracecmd_Click() key = "erace" oval.Visible = True pencilcmd.Enabled = True linecmd.Enabled = True eracecmd.Enabled = True eracecmd.Enabled = False brushcmd.Enabled = True rbrushcmd.Enabled = True End Sub Private Sub fgshow_Click() 26

cmd.ShowColor pict.ForeColor = cmd.Color fgshow.BackColor = cmd.Color End Sub Private Sub Form_Load() size.Value = 5 key = "pencil" End Sub Private Sub mnu_cnvassize_Click() CanvasSize_frm.Show End Sub Private Sub newmnu_Click() If MsgBox("Are you sure?", vbYesNo, "Conformation") = vbYes Then pict.Cls End If End Sub Private Sub open_Click() cmd.ShowOpen pict.Picture = LoadPicture(cmd.FileName) End Sub Private Sub pict_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyControl Then ctrl = True End If End Sub Private Sub pict_KeyUp(KeyCode As Integer, Shift As Integer) ctrl = False 27

size.Value = tempsize End Sub Private Sub pict_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single) If runtime = True Then masktemp = pict.image End If If Button = 1 Then If key = "erace" Then pict.ForeColor = RGB(253, 253, 253) pict.DrawWidth = size.Value pict.PSet (x, y) End If state = "down" pict.ForeColor = cmd.Color If key = "line" Then xf = x yf = y End If End If End Sub Private Sub pict_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single) xxx = Val(oval.Width) / 2 yyy = Val(oval.Height) / 2 oval.Move x - xxx, y - yyy, (size.Value * 10) + 200, (size.Value * 10) + 200 If key = "pencil" Or key = "erace" Then oval.Visible = True End If 28

If Button = 1 Then If state = "down" Then pict.DrawWidth = size.Value If key = "pencil" Then oval.Visible = True pict.DrawWidth = size.Value pict.PSet (x, y) End If If key = "erace" Then pict.ForeColor = RGB(253, 253, 253) pict.DrawWidth = size.Value pict.PSet (x, y) End If If key = "line" Then linv.Visible = True linv.BorderWidth = size.Value linv.BorderColor = cmd.Color linv.X1 = xf linv.Y1 = yf linv.X2 = x linv.Y2 = y End If If key = "brush" Then If ctrl = True Then pict.Line (x, y - 100 * size.Value)-(x, y) Else pict.Line (x - 100 * size.Value, y)-(x, y) 29

End If End If If key = "rbrush" Then Dim tempsize As Integer tempsize = size.Value pict.DrawWidth = 1 pict.Circle (x, y), (size.Value * 5) + 10 End If End If End If End Sub Private Sub pict_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single) runtime = True linv.Visible = False If Button = 1 Then state = "up" If key = "line" Then pict.Line (xf, yf)-(x, y) End If End If End Sub Private Sub linecmd_Click() key = "line" oval.Visible = False brushcmd.Enabled = True pencilcmd.Enabled = True linecmd.Enabled = False 30

eracecmd.Enabled = True rbrushcmd.Enabled = True End Sub Private Sub pencilcmd_Click() key = "pencil" oval.Visible = True pencilcmd.Enabled = False linecmd.Enabled = True eracecmd.Enabled = True brushcmd.Enabled = True rbrushcmd.Enabled = True End Sub Private Sub rbrushcmd_Click() key = "rbrush" oval.Visible = True pencilcmd.Enabled = True brushcmd.Enabled = True eracecmd.Enabled = True linecmd.Enabled = True rbrushcmd.Enabled = False End Sub Private Sub save_Click() cmd.ShowSave outputfile = True SavePicture pict.image, cmd.FileName + cmd.Filter End Sub Private Sub slctbg_Click() 31

cmd2.ShowColor pict.BackColor = cmd2.Color bgshow.BackColor = cmd2.Color End Sub Private Sub slctclor_Click() cmd.ShowColor pict.ForeColor = cmd.Color fgshow.BackColor = cmd.Color End Sub Private Sub Toolbar1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single) oval.Visible = False End Sub Private Sub Toolbar2_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single) oval.Visible = False End Sub

DEBUG CHART: Serial Error Name no.


1 2 Expected list seperator Expected : expression

Error Location
Compile error Compile error

SULTION TO THE ERRORS


Pict.line(x,y-100*size.value)-(x,y) Pict.Drawwidth=size.value

32

SCREEN SHOT:

RESULT:
The above program has been executed and the output was verified successfully.

33

EXPERIMENT NUMBER 6 DATE: 10.10.2011 TO CREATE A PROGRAM LAUNCHER WINDOWS APPLICATION

PROBLEM DEFINITION:
Program launcher shutdown utility appliacton help us to shutdown,restart,logoff our computer

DESIGN OF SPECIFICATION: CONTROL


Button Button Button Button

NAME OF CONTROL
Button1 Button2 Button3 Button4

DESCRIPTION
Use for the shutdown command Use for the restart command Use for the logoff command Use for the exit command

SOURCE CODE:
Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click System.Diagnostics.Process.Start("shutdown", "-s -t 00") End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click System.Diagnostics.Process.Start("shutdown", "-r -t 00") End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click System.Diagnostics.Process.Start("shutdown", "-l -t 00") End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click End End Sub 34

End Class

SCREEN SHOT:

RESULT:
The above program has been executed and the output was verified successfully.

35

EXPERIMENT NUMBER 7 DATE:17.10.2011 DESIGN A STUDENT MARK GRADING APPLICATION

PROBLEM DEFINITION:
A database application is created to obtain the grade of student. It should provide provisions for entering students details with the respective courses and marks obtained. On the basis of marks a grade is given to individual student.

DESIGN OF SPECIFICATION: CONTROL


Data control Data control Datacontrol Textbox Label Buttons

NAME OF CONTROL
Datstdnt Datcourse Datmrks Text1 Label1 Button1

DESCRIPTION
Use for accessing data from the student table Use for accessing data from the course table Use for accessing data from the marks table Use for taking appropriate input Use to describe the appropriate control Use for performing operations like addition,deletion and editing details of the records in the particular table

SORCE CODE :
FORM1 Private Sub add_Click() Form3.Show End Sub Private Sub add1_Click() Form2.Show End Sub Private Sub delete1_Click() 36

Form5.Show End Sub Private Sub grade_Click(Index As Integer) Form6.Show End Sub Private Sub insert_Click(Index As Integer) Form4.Show End Sub FORM 2 Private Sub Command1_Click() dat.Recordset.AddNew dat.Recordset.Fields(0) = (Text2.Text) dat.Recordset.Fields(1) = Val(Text3.Text) dat.Recordset.Fields(2) = (Text4.Text) dat.Recordset.Fields(3) = Val(Text1.Text) dat.Recordset.Update MsgBox "New item added!!" End Sub Private Sub Command2_Click() Me.Hide Form1.Show End Sub Private Sub Command3_Click() Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" 37

dat.Recordset.AddNew dat.Recordset.Fields(0) = (Text2.Text) dat.Recordset.Fields(1) = Val(Text3.Text) dat.Recordset.Fields(2) = (Text4.Text) dat.Recordset.Fields(3) = Val(Text1.Text) dat.Recordset.Update End Sub Form 3 Private Sub Command1_Click() datcourse.Recordset.AddNew datcourse.Recordset.Fields(0) = Val(Text1.Text) datcourse.Recordset.Fields(1) = Val(Text2.Text) datcourse.Recordset.Update MsgBox "New item added!!" End Sub

Private Sub Command2_Click() Form1.Show Me.Hide End Sub Private Sub Command3_Click() Text1.Text = "" Text2.Text = "" datcourse.Recordset.AddNew datcourse.Recordset.Fields(0) = Val(Text1.Text) datcourse.Recordset.Fields(1) = (Text2.Text) datcourse.Recordset.Update 38

MsgBox "New item added!!" End Sub FORM 4 Private Sub Command1_Click() datmrks.Recordset.AddNew datmrks.Recordset.Fields(0) = Val(Text1.Text) datmrks.Recordset.Fields(1) = Val(Text2.Text) datmrks.Recordset.Fields(2) = Val(Text3.Text) datmrks.Recordset.Fields(3) = Val(Text4.Text) datmrks.Recordset.Fields(4) = Val(Text5.Text) datmrks.Recordset.Update MsgBox "New item added!!" End Sub

Private Sub Command2_Click() Me.Hide Form1.Show End Sub Private Sub Command3_Click() Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" datmrks.Recordset.AddNew datmrks.Recordset.Fields(0) = Val(Text1.Text) datmrks.Recordset.Fields(1) = Val(Text2.Text) 39

datmrks.Recordset.Fields(2) = Val(Text3.Text) datmrks.Recordset.Fields(3) = Val(Text4.Text) datmrks.Recordset.Fields(4) = Val(Text5.Text) datmrks.Recordset.Update End Sub FORM 4 Private Sub Command1_Click() dat.Recordset.delete MsgBox "item deleted!!" End Sub

Private Sub Command2_Click() Me.Hide Form1.Show End Sub

Private Sub Command3_Click() Text1.Text = "" Text2.Text = "" Text3.Text = "" Text4.Text = "" Text5.Text = "" datmrks.Recordset.AddNew datmrks.Recordset.Fields(0) = Val(Text1.Text) datmrks.Recordset.Fields(1) = Val(Text2.Text) datmrks.Recordset.Fields(2) = Val(Text3.Text) datmrks.Recordset.Fields(3) = Val(Text4.Text) 40

datmrks.Recordset.Fields(4) = Val(Text5.Text) datmrks.Recordset.Update End Sub FORM 5 Private Sub Command2_Click() Me.Hide Form1.Show End Sub Private Sub Command3_Click() dat.Recordset.MoveFirst Text1.Text = dat.Recordset.Fields(1) Text2.Text = dat.Recordset.Fields(2) Text3.Text = dat.Recordset.Fields(3) Text4.Text = dat.Recordset.Fields(0) dat.Recordset.MoveNext End Sub Private Sub Command4_Click() dat.Recordset.MoveFirst Text1.Text = dat.Recordset.Fields(1) Text2.Text = dat.Recordset.Fields(2) Text3.Text = dat.Recordset.Fields(3) Text4.Text = dat.Recordset.Fields(0) End Sub FORM 6 Private Sub Command1_Click() Dim sid As Integer Dim cid As Integer 41

Dim m1, m2, m3, avg As Integer sid = Val(Text1.Text) cid = Val(Text2.Text) While Not datmrks.Recordset.EOF If sid = datmrks.Recordset.Fields(0) And cid = datmrks.Recordset.Fields(1) Then m1 = datmrks.Recordset.Fields(2) m2 = datmrks.Recordset.Fields(3) m3 = datmrks.Recordset.Fields(4) End If datmrks.Recordset.MoveNext Wend avg = (m1 + m2 + m3) / 3 If (avg <= 100 And avg > 90) Then MsgBox ("Grade is A+") ElseIf (avg <= 90 And avg > 80) Then MsgBox ("Grade is A") ElseIf (avg <= 80 And avg > 70) Then MsgBox ("Grade is B") Else MsgBox ("Grade is C") End IfEnd Sub

42

DEBUG CHART: Serial Error Name no.


1 2 Unqualified reference Datatype conversion error Invalid or unqualified reference

Error Location

Solution to Errors

Datmrks.recordset.addnew Specify the database name property of the datmrk control When the recordsource Specify the recordsource name to name is specified the correct table name incorrectly Dat.recordset .update Dat.recordset.update

SCREEN SHOT:

43

44

RESULT:
The above program has been executed and the output was verified successfully.

45

EXPERIMENT NUMBER 8 DATE: 31/10/2011

TO DESIGN AND IMPLEMENT A ON SCREEN KEYBOARD USING VISULA BASIC

PROBLEM DEFINITION:
Instead of relying on the physical keyboard to type and enter data, you can use On-Screen Keyboard. On-Screen Keyboard displays a visual keyboard with all the standard keys. You can select keys using the mouse or another pointing device, or you can use a single key or group of keys to cycle through the keys on the screen.

DESIGN OF SPECIFICATION: CONTROL


BUTTONS BUTTONS RICH TEXTBOX COMMON DIALOGBOX FRAMES CHECKBOX CHECKBOX CHECKBOX

NAME OF CONTROL
BUTTON 1 to 20 BUTTON 23 to 35 Richtextbox1 Commondialog1 Frame1,frame2 Checkbox1 Checkbox2 Checkbox3

DESCRIPTION
To take characters as an input from user To take number and symbol as an input from user For selecting text, font style,font color etc For file open,file close,show font etc For arranging all the buttons To check capslock is checked or not To check ctrl is checked or not To check alt is checked or not

SOURCE CODE:
Dim current As String Dim abc As Integer Private Sub back_Click() abc = Len(Text1.Text) - 1 If abc < 0 Then abc = 0

46

Text1.Text = Left(Text1.Text, abc) Text1.SelStart = Len(Text1.Text) Text1.SetFocus End Sub Private Sub Command1_Click() If Check1.Value = 1 Then Text1.Text = (Text1.Text + "Q") Else Text1.Text = (Text1.Text + "q") End If current = Val(Text1.Text) .End Sub Private Sub Command10_Click() Text1.Text = Text1.Text + Command10.Caption current = Val(Text1.Text) End Sub Private Sub Command12_Click() If Check1.Value = 1 Then Text1.Text = (Text1.Text + "W") Else Text1.Text = (Text1.Text + "w") End If current = Val(Text1.Text) End Sub Private Sub Command13_Click() If Check1.Value = 1 Then Text1.Text = (Text1.Text + "E") 47

Else Text1.Text = (Text1.Text + "e") End If current = Val(Text1.Text) .End Sub Private Sub Command14_Click() If Check1.Value = 1 Then Text1.Text = (Text1.Text + "R") Else Text1.Text = (Text1.Text + "r") End If current = Val(Text1.Text) End Sub Private Sub Command15_Click() If Check1.Value = 1 Then Text1.Text = (Text1.Text + "T") Else Text1.Text = (Text1.Text + "t") End If current = Val(Text1.Text) .End Sub Private Sub Command16_Click() If Check1.Value = 1 Then Text1.Text = (Text1.Text + "Y") Else Text1.Text = (Text1.Text + "y") End If 48

current = Val(Text1.Text) End Sub Private Sub Command17_Click() If Check1.Value = 1 Then Text1.Text = (Text1.Text + "U") Else Text1.Text = (Text1.Text + "u") End If current = Val(Text1.Text) End Sub Private Sub Command18_Click() If Check1.Value = 1 Then Text1.Text = (Text1.Text + "I") Else Text1.Text = (Text1.Text + "i") End If current = Val(Text1.Text) End Sub Private Sub Command19_Click() If Check1.Value = 1 Then Text1.Text = (Text1.Text + "O") Else Text1.Text = (Text1.Text + "o") End If current = Val(Text1.Text) End Sub Private Sub Command2_Click(Index As Integer) 49

Text1.Text = Text1.Text + Command2(Index).Caption num = Val(Text1.Text) End Sub Private Sub Command20_Click() If Check1.Value = 1 Then Text1.Text = (Text1.Text + "P") Else Text1.Text = (Text1.Text + "p") End If current = Val(Text1.Text) End Sub Private Sub Command21_Click() If Check2.Value = 1 Then Text1.SelStart = 0 Text1.SelLength = Len(Text1.Text) Text1.SelColor = vbBlue ElseIf Check1.Value = 1 Then Text1.Text = (Text1.Text + "A") Else Text1.Text = (Text1.Text + "a") End If current = Val(Text1.Text) End Sub Private Sub Command22_Click() If Check1.Value = 1 Then Text1.Text = (Text1.Text + "F") Else 50

Text1.Text = (Text1.Text + "f") End If current = Val(Text1.Text) End Sub Private Sub Command23_Click() If Check1.Value = 1 Then Text1.Text = (Text1.Text + "G") Else Text1.Text = (Text1.Text + "g") End If current = Val(Text1.Text) .End Sub Private Sub Command24_Click() If Check1.Value = 1 Then Text1.Text = (Text1.Text + "H") Else Text1.Text = (Text1.Text + "h") End If current = Val(Text1.Text) End Sub Private Sub Command25_Click() If Check2.Value = 1 Then CommonDialog1.ShowSave Text1.SaveFile (CommonDialog1.FileName) ElseIf Check1.Value = 1 Then Text1.Text = (Text1.Text + "S") Else 51

Text1.Text = (Text1.Text + "s") End If current = Val(Text1.Text) End Sub Private Sub Command26_Click() If Check1.Value = 1 Then Text1.Text = (Text1.Text + "D") Else Text1.Text = (Text1.Text + "d") End If current = Val(Text1.Text) .End Sub Private Sub Command3_Click(Index As Integer) Text1.Text = Text1.Text + Command3(Index).Caption current = Val(Text1.Text) End Sub .Private Sub Command31_Click() If Check1.Value = 1 Then Text1.Text = (Text1.Text + "N") Else Text1.Text = (Text1.Text + "n") End If current = Val(Text1.Text) End Sub Private Sub Command32_Click() If Check2.Value = 1 Then Text1.Text = current 52

ElseIf Check1.Value = 1 Then Text1.Text = (Text1.Text + "Z") Else Text1.Text = (Text1.Text + "z") End If current = Val(Text1.Text) End Sub Private Sub Command33_Click() If Check3.Value = 1 Then End ElseIf Check2.Value = 1 Then current = Text1.SelText Text1.Text = "" ElseIf Check1.Value = 1 Then Text1.Text = (Text1.Text + "X") Else Text1.Text = (Text1.Text + "x") End If End Sub Private Sub Command34_Click() If Check2.Value = 1 Then current = Text1.SelText ElseIf Check1.Value = 1 Then Text1.Text = (Text1.Text + "C") Else Text1.Text = (Text1.Text + "c") End If 53

End Sub Private Sub Command35_Click() If Check2.Value = 1 Then Text1.SelText = current ElseIf Check1.Value = 1 Then Text1.Text = (Text1.Text + "V") Else Text1.Text = (Text1.Text + "v") End If current = Val(Text1.Text) End Sub Private Sub Command36_Click() If Check1.Value = 1 Then Text1.Text = (Text1.Text + "B") Else Text1.Text = (Text1.Text + "b") End If current = Val(Text1.Text) End Sub Private Sub del_Click() Text1.Text = "" Text1.SetFocus End Sub Private Sub Enter_Click() Text1.Text = Text1.Text & vbCrLf & "" Text1.SelStart = Len(Text1.Text) Text1.SetFocus 54

End Sub Private Sub esc_Click() End End Sub Private Sub Form_Load() Text1.Text = "" End Sub Private Sub print_Click() If Check2.Enabled = True Then CommonDialog1.ShowPrinter End If End Sub Private Sub space_Click() Text1.Text = Text1.Text + " " Text1.SelStart = Len(Text1.Text) Text1.SetFocus End Sub Private Sub tab_Click() Text1.Text = Text1.Text + " Text1.SelStart = Len(Text1.Text) Text1.SetFocus End Sub "

55

DEBUG CHART: Serial Error Name no.


1 2 3 4 Method or data member not found Data member not found Only comment may appear after end sub Type mismatch

Error Location
Compile error Compile error Comile error 13

SULTION TO THE ERRORS


selectedrtf Check1.value=1 End function Command1_click

SCREEN SHOT:

RESULT : The above program has been executed and the output was verified successfully.

56

57

Das könnte Ihnen auch gefallen