Data files and databases. Need a control to browse to a file Standard controls for drive folder and list not much use The CommonDialogs control offers.

Slides:



Advertisements
Similar presentations
DREAMWEAVER Welcome to our website!
Advertisements

MS-Access XP Lesson 1. Introduction to MS-Access Database Management System Software (DBMS) Store data in databases Database is a collection of table.
Benchmark Series Microsoft Access 2010 Level 1
Adding Narration to PowerPoint John Westfall. Record this slide Follow the instructions Start the recording End the recording Remember the linked files.
MS-Access XP Lesson 2. Input Mask Property 1.Field : Phone No Data Type : Number Input Mask : Character 0 represent a single digit and phone.
File Handling Advanced Higher Programming. What is a file? Up until now, any stored data within a program is lost when the program closes. A file is a.
Alford Academy Business Education and Computing1 Advanced Higher Computing Based on Heriot-Watt University Scholar Materials File Handling.
Guide to Oracle10G1 Introduction To Forms Builder Chapter 5.
Component 9, Slide 1 CP2030 Copyright © University of Wolverhampton CP2030 Visual Basic for C++ Programmers v Component 9 working with text files and random.
Creating Custom Forms. 2 Design and create a custom form You can create a custom form by modifying an existing form or creating a new form. Either way,
Reading and Writing Files Keeping Data. Why do we use files? ä For permanently storing data. ä For dealing with information too large to fit in memory.
Access Tutorial 1 Creating a Database
Chapter 8 - Visual Basic Schneider1 Chapter 8 Sequential Files.
Chapter 7 Data Management. Agenda Database concept Import data Input and edit data Sort data Function Filter data Create range name Calculate subtotal.
Slide 1 VB Default Controls Text Box, Check Box, Option Button & Frames.
Access Tutorial 8 Sharing, Integrating, and Analyzing Data
With Alex Conger – President of Webmajik.com FrontPage 2002 Level I (Intro & Training) FrontPage 2002 Level I (Intro & Training)
Chapter 9 Files I/O: Files, Records and Fields. Basics of File Input and Output Have created both input and outputs from programs. Persistent data: What.
Chapter 5 Basics of File Input and Output Reading, Writing, and Printing Text Files 5 Exploring Microsoft Visual Basic 6.0 Copyright © 1999 Prentice-Hall,
Visual C Sharp – File I/O - 1 Variables and arrays only temporary - lost when a program terminates Files used for long term storage (Data bases considered.
Chapter 1 Databases and Database Objects: An Introduction
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 4 1 Microsoft Office FrontPage 2003 Tutorial 4 – Using Shared Borders and Themes.
Break Processing Please use speaker notes for additional information!
Computers Data Representation Chapter 3, SA. Data Representation and Processing Data and information processors must be able to: Recognize external data.
The Common Dialog Box. Installing the Common Dialog Box May NOT be your standard VB toolbox.
CSC 240 (Blum)1 Random Topics: OLE Objects, Mail Merge and XML Exporting.
Chapter 7 Code Tables. VB Code Box 7-1 Event Procedure for Compute Button Private Sub hsbExemptions_Change() txtExemptions.Text =Str(hsbExemptions.Value)
Copyright © 2001 by Wiley. All rights reserved. Chapter 2: Using Visual Basic to Create a First Project Getting Started with VB Development Environment.
Microsoft Office 2007 Access Chapter 6 Using Macros, Switchboards, PivotTables, and PivotCharts.
VB Core II Conditional statements Exception handling Loops Arrays Debugging.
Your Smart Board is on most of the day….. Why not use the space for learning?
V 1.0Slide 1 Staff – Basic Info. V 1.0Slide 2 Staff – Basic Info Input the search criteria. Click search to start searching.
MS Visual Basic Applications Walter Milner. Event-driven programming Standard approach for GUIs Contrast with old character interfaces – program determines.
Random Files Please see speaker notes for additional information!
COMPREHENSIVE Access Tutorial 12 Managing and Securing a Database.
® Microsoft Access 2010 Tutorial 12 Managing and Securing a Database.
ECDL. Word processing Work with documents and save them in different file formats Choose built-in options such as the Help function to enhance productivity.
® Microsoft PowerPoint 2010 ® Tutorial 3 Adding Special Effects to a Presentation.
Data types  CHAR (size): This data type is used to store character strings values of fixed length. The size in brackets determines the number of characters.
Sequential files School of Business Eastern Illinois University © Abdou Illia, Spring 2003 (Week 12, Monday 4/07/2003)
Using Text Files in Excel File I/O Methods. Working With Text Files A file can be accessed in any of three ways: –Sequential access: By far the most common.
Programming games using Visual Basic Files; files vs. databases Reprise on state of program Lab/HW: work on projects, final project.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 7 1 Microsoft Office FrontPage 2003 Tutorial 8 – Integrating a Database with a FrontPage.
Slide 1 Using Menu Bar & Common Dialog Boxes. Slide 2 Setting Up the Main Items v First open the form on which you want the menu located v Then start.
Lesson 13 Databases Unit 2—Using the Computer. Computer Concepts BASICS - 22 Objectives Define the purpose and function of database software. Identify.
INTRODUCTION TO ACCESS. OBJECTIVES  Define the terms field, record, table, relational database, primary key, and foreign key  Create a blank database.
1 Chapter 10 – Database Management 10.1 An Introduction to Databases 10.2 Editing and Designing Databases.
Introduction to Files in VB Chapter 9.1, 9.3. Overview u Data Files  random access  sequential u Working with sequential files  open, read, write,
CECS 5020 Computers in Education Visual Basic Variables and Constants.
BACS 287 File-Based Programming. BACS 287 Data Hierarchy  Database - Collection of files, relationships, integrity information, etc  Files - All records.
Visual Basic Review LBS 126. VB programming Project Form 1Form 2Form 3 Text boxButton Picture box Objects Text box Button Objects.
Tutorial 81 Field, Record, Data File Field - a single item of information about a person, place, or thing Record - a group of related fields that contain.
Introduction to VB programming Dr. John P. Abraham UTPA Chapters 2 & 3.
Using a Database Access97 Please use speaker notes for additional information!
XP New Perspectives on Microsoft Office Access 2003, Second Edition- Tutorial 6 1 Microsoft Office Access 2003 Tutorial 6 – Creating Custom Forms.
TOOLBOX. The Toolbox Intrinsic Controls - always included in the Toolbox ActiveX Controls - separate files with ocx file extension Insertable Objects.
Creation of Variables with Numeric, alphanumeric, date, picture, memo data types Constant - A quantity that does not change during the execution of a program.
Lesson 7: Using Mail Merge
Especially created for ASL faculty. By Gloria Barron.
Visual Basic - Break Processing
Chapter 2 – Introduction to the Visual Studio .NET IDE
Binary Files.
Access Tutorial 8 Sharing, Integrating, and Analyzing Data
Visual Basic 6 Programming.
Saving and Accessing Data
Grauer and Barber Series Microsoft Access Chapter Two
Step 1:. Open Microsoft FrontPage application.
Microsoft PowerPoint 2010 for Microsoft Windows
Tutorial 8 Sharing, Integrating, and Analyzing Data
Tutorial 12 Managing and Securing a Database
Presentation transcript:

Data files and databases

Need a control to browse to a file Standard controls for drive folder and list not much use The CommonDialogs control offers –drive folder file browse to select file –print –font select –colour select But you need to add it in..

Adding components

Using the Common Dialog Control Private Sub Command1_Click() CommonDialog1.ShowOpen MsgBox ("You selected " & CommonDialog1.FileName).. code to process FileName End Sub

File open exercise Program to browse and display graphics files Use a common dialog control to select graphics files Set the filter of the dialog to something like: Image files | *.bmp; *.jpg; *.jpeg | All files | *.* Display the selected image in a Picture control (see graphics)

VB data file ideas 2 modes – sequential (work through file start to end - character (external format)) random (can move back and forth through file, binary (internal format) )

Sequential – write # and input# Open "c:\walter\vb\filing\test1.dat" For Output As #1 Write #1, 1, 2, 3.1, "Test1", "Test2" Close #1 Open "c:\walter\vb\filing\test1.dat" For Input As #1 Input #1, x, y, z, a, b Close #1

Sequential – Print # and Line Input# Open "c:\walter\vb\filing\test1.dat" For Output As #1 Print #1, 1, 2, "Test1" Close #1 Open "c:\walter\vb\filing\test1.dat" For Input As #1 Line Input #1, x Close #1 MsgBox (x)

Exercise – sequential filing 1.Fill an array with 100 random integers 2.Save them into a file ( write# ) 3.Read file back ( input# ) into a second array 4.Check arrays have same content

Random Data in file as records Must define size of record (fixed length good) Can then seek to nth record And read or write it

User-defined type (record) Private Type myRecord payroll As Integer department As Integer name As String * 14 End Type fixed length string length of record = = 18 bytes

Writing to random access file Dim emp As myRecord emp.payroll = 23 emp.department = 3 emp.name = "Fred" Open "c:\walter\vb\filing\test.dat" For Random As #1 Len = 18 Put #1, 1, emp emp.payroll = 17 emp.department = 6 emp.name = "John" Put #1, 2, emp Put #1, 3, emp Close #1 result on next slide record position 1

Random file contents record 1 record 2 record 3 2 bytes = integer = 23 2 bytes = 1 integer = 3 string padded with spaces to length 14

Reading Random File Dim emp As myRecord Open "c:\walter\vb\filing\test.dat" For Random As #1 Len = 18 Get #1, 2, emp Close #1 MsgBox (emp.payroll & " " & emp.department & " " &_ emp.name) read second record

Binary = random with record size 1 Dim b As Byte Open "c:\walter\vb\filing\test.dat" For Binary As #1 For bytePosition = 1 To 10 Get #1, bytePosition, b Debug.Print b Next Close #1

Exercise – data file Using binary mode, write the characters A to Z into a file (ASCII 65 on) Then read them back in reverse ie byte position 26 first Debug.print them out

Working with a database – the hard way

Private Sub Command1_Click() Data1.Recordset.Delete Data1.Refresh End Sub

Working with a database – the wizard Addins..Addin Manager

Working with a database – the wizard

Exercise – database access Use Access to produce a simple database with just one table – personnel = ID name and department number (Access97 format) In a VB project have two forms –one with a data control, hand-coded (explore insert delete buttons) –one created by the Data Form Wizard