1 / 51

WORKING WITH FILES, MENUS AND DATABASES IN VISUAL BASIC

WORKING WITH FILES, MENUS AND DATABASES IN VISUAL BASIC. BY V. V. SUBRAHMANYAM. Working with files. Visual Basic File System Controls DriveList Box DirList Box FileList Box. DriveList Box control. Is a drop down list box Displays the list of drives on your computer

cayla
Télécharger la présentation

WORKING WITH FILES, MENUS AND DATABASES IN VISUAL BASIC

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. WORKING WITH FILES, MENUS AND DATABASES IN VISUAL BASIC BY V. V. SUBRAHMANYAM

  2. Working with files • Visual Basic File System Controls DriveList Box DirList Box FileList Box

  3. DriveList Box control • Is a drop down list box • Displays the list of drives on your computer • The change is recorded in Drive property of the DriveList Box

  4. DirList Box Control • It is a Drop down list box • Displays the hierarchical list of Directories in the current drive

  5. FileList Box • It is a Drop down list box • Displays all files in the current directory or folder and also allows the user to set up search criteria for files

  6. Advantages of file system controls • These three controls used together can create an elegant interface that will allow the user to locate a file on his computer

  7. Private Sub Dir1_Change() File1.Path = Dir1.Path End Sub Private Sub Drive1_Change() Dir1.Path = Drive1.Drive End Sub Private Sub Text1_Change() File1.Pattern = Text1.Text End Sub

  8. File functions • ChDrive - Changes the current logged drive • ChDir - Changes the default directory • MkDir - Creates a new directory • RmDir - Deletes a directory • Name - Renames a file

  9. Contd… • Kill - Deletes a file • FileCopy - Copies a file from src to des • FileDateTime – Returns the date and time when the file was modified • GetAttr - Returns the attributes of a file as an integer value • SetAttr - Sets the attributes of a file

  10. Menus • Contains a no. of options, logically organized and easily accessible. • In VB Menus can be created using the Menu Editor • Menu is tied to a form.

  11. Menu Conventions • Keep menu captions short and simple • Follow the Windows conventions while naming and ordering the menu items • Keep the list of menu items short • Use separators to logically group menu options • Provide necessary keyboard shortcuts

  12. Multiple Document Interface (MDI) • MDI was designed for applications which need to show more than one document(multiple documents) at the same time, with each document displayed in its own window.

  13. Why MDI forms? • MDI form acts like a container for the other forms in the application • Most of the control buttons and code for the various forms can be shared • Reduces the no. of controls

  14. MDI Application • An application can have only one MDI form • One or more MDI Child Form(s) • Optionally independent forms and modules

  15. Data Base • It is a collection of records stored in tables. • Information is stored in tabular form and is called a table. Columns  Fields Rows  Records • The collection of the tables is called as database and are stored in a file.

  16. Three categories of databases • Visual Basic recognizes 3 categories of databases Visual basic database External databases ODBC databases

  17. Creating a table • You can create your own tables using • DAO(Data Access Objects) • Microsoft Access and others • Visual Data Manager

  18. Visual Data Manager • Visual Data manager makes the job of table creation and modification very simple. • This can work with MS-Access, Dbase, Paradox and text files also.

  19. Data Control • Establishes a connection to a database • Returns a set of records from the database • Enables you to move from record to record • Enables you to display and manipulate data from the records in bound controls

  20. Properties to be set to Data control • Two properties to be set at runtime or design time are: DatabaseName: Specifies the name of the database that must be opened RecordSource: Specifies the name of the table(s) of the database from which the data has to be extracted

  21. Data-Aware Control • It is the control that provides access to a specific field in a database through a data control.This can be bound to a data control through its data source and data field properties.

  22. DBlist, Dbcombo and Dbgrid • These controls are all capable of managing sets of records when bound to a Data Control. All of these controls permit several records to be displayed or to be manipulated at a time.

  23. `Object Linking and Embedding(OLE) • To create an application that can display data from many different applications and enables the user to edit that data from with in the application in which it was created.

  24. OLE DB • It is defined as a new low-level interface that is part of the Universal Data Access platform. • It is general purpose set of interfaces designed to let developers build data access tools as components using the COM.

  25. Additional Controls Sstab control • Provides an easy way of presenting several dialogs or screens of information on a single form, using the same interface seen in many commercial Windows applications.

  26. ImageList control • This control acts like a repository of images for the other controls

  27. MSFlexGrid control • This displays and operates on data in a table form

  28. Toolbar Control • This is used to create a toolbar for the application, just like Toolbars for applications like Word or Excel or others.

  29. Statusbar Control • This control holds up to a maximum of sixteen panels or frames each of these panel given different types of information like time, microhelp, status of a key etc..

  30. Treeview Control • To display the data as a hierarchy. It displays the drives, directories, subdirectories and files in the form of a hierarchy.

  31. ActiveX Data object • This enables the client applications to access and manipulate data in a database serer through any of the OLE DB providers.

  32. Benefits of ADO • Ease of use • High speed • Low memory overheads • Small disk footprint

  33. ADO support • ADO support key features for building client/server and Web-based applications.

  34. BUG • The error or the problem occurred in the system is called as a bug

  35. Debugging • The process of finding out and removing the error is called debugging.

  36. Types of Bugs • Errors of syntax • Logical errors • Runtime Errors

  37. Debugging Methods • The Message box • Debug.print • Debug Toolbar • Error Handler

  38. Message Box • To display the state of values that have been assigned to a variable Dim I as integer For I = 1 to 20 step 4 MsgBox I ----- Next I

  39. Debug.print • The debug object will send the output to the immediate window. Dim I as integer For I = 1 to 20 Step 4 Debug.print I Next I

  40. Debug Toolbar • To begin debugging, Debug Toolbar is required. • To bring up, right click the toolbar and select Debug from the pop-up menu

More Related