• No results found

Basics of Visual FoxPro Programming

N/A
N/A
Protected

Academic year: 2021

Share "Basics of Visual FoxPro Programming"

Copied!
51
0
0

Loading.... (view fulltext now)

Full text

(1)
(2)

Objectives:

• To be able to give basic information about FoxPro

Environment.

• To give an overview about basic VFP commands.

• To give an overview about basic VFP controls.

• To give an overview about basic VFP codes.

(3)

What To Learn in Visual Fox Pro

• Working With Command Window

– Creating a New Table

– Modify the Structure of a Table

– Displaying and Editing Data

• Append Command

• Browse Command

• Replace Command

(4)

What To Learn in Visual Fox Pro cont.

• Delete and Recall Command

– Pack Command

– Zap Command

– Recall Command

• Run Command

(5)

What To Learn in Visual Fox Pro cont.

Creating Control Objects

Project

Database

Table

Form

Report

Menu

(6)

What To Learn in Visual Fox Pro cont.

Building Control Objects and its Properties

Textbox

Command Button

Option Group

Check Box

Combo Box

List Box

Page frame

Image frame

Timer

(7)

What To Learn in Visual Fox Pro cont.

Basic Codes of FoxPro

Add

Save

Delete

Search

Next Button

Back Button

Timer

(8)

Working with Command Window

The Command window is a Visual FoxPro system window. When you choose menu commands, Visual FoxPro

language commands are echoed in the Command window.

(9)

Working with Command Window

Creating New Table

Syntax :

create <table name>

To create a table file from command window type the word CREATE followed by the

name of the table file, and press Enter key.

(10)

Working with Command Window

Modify the Structure of a Table

Syntax:

Modify Structure

From the command window we can modify the structure by

typing the MODIFY

(11)

Working with Command Window

Displaying and Editing Data

Working from the command window, we can USE a table and then type one of the following:

APPEND to display the table in Append mode. •

BROWSE to display the table in browse mode. •

(12)

Working with Command Window

Displaying and Editing Data

APPEND - This command

is used to add records to the active database file.

Syntax:

Append

Append Blank

APPEND Blank - will add

a blank record at the bottom of the screen.

(13)

Working with Command Window

Displaying and Editing Data

Browse - This is a

powerful editing command provide us facility to edit records horizontally with

showing us multiple records at a time.

Syntax:

(14)

Working with Command Window

Displaying and Editing Data

Replace - This is a

powerful editing

command. This is used to replace a new

value in a field with or without a condition.

Syntax:

(15)

Working with Command Window

Delete and Recall Command

Replace - This is a

powerful editing

command. This is used to replace a new

value in a field with or without a condition.

Syntax:

(16)

Working with Command Window

Delete and Recall Command

Pack - This command is

used to physically remove all those records which was marked for deletion.

Syntax:

(17)

Working with Command Window

Delete and Recall Command

Zap- This command is used

to erases all records of active database except its structure.

Syntax:

(18)

Working with Command Window

Delete and Recall Command

Recall- This command is

used to unmark the specified record which was marked for deletion.

Syntax:

(19)

Working with Command Window

Run command

We can execute any DOS command or non Visual FoxPro program without quitting from Visual FoxPro.

Syntax:

(20)

Working with Command Window

Set Default

Visual FoxPro uses its default drive and directory

for

creating files, unless we specify the path separately.

Syntax:

(21)

Creating Control Object

Project

From the menu click File

Select New

(22)

Creating Control Object

(23)

Creating Control Object

Table

From the menu click File

Select New

(24)

Creating Control Object

(25)

Creating Control Object

Form

From the menu click File

Select New

(26)

Creating Control Object

(27)

Creating Control Object

Report

From the menu click File

Select New

(28)

Creating Control Object

(29)

Creating Control Object

Menu

From the menu click File

Select New

(30)

Creating Control Object

(31)

Building Control Objects

Textbox Option Button Command Button Command Group Combo Box Check Box Image List Box Timer

Page Frame

(32)

Building Control Object

Text Box

The text box is the basic control that allows users to add or edit data in a Character, Numeric, or Date

(33)

Building Control Object

Text Box Properties

Alignment: center

PasswordChar: *

BackStyle: 0-Transparent

BorderStyle: 0-None

(34)

Building Control Object

Command Button

is typically used to start an event that performs an action such as closing a form, moving to a different

(35)

Building Control Object

Command Button Properties

Caption: Save

Picture:

(36)

Building Control Object

Option Group

You can use a group of option buttons to provide a selection of predetermined choices.

(37)

Building Control Object

Option Group Properties

Value =:0

BackStyle: 0- Transparent

BorderStyle: 0- None

(38)

Building Control Object

Check Box

You can use a check box to switch between three states, True (.T.), False (.F.), and Null

(39)

Building Control Object

(40)

Building Control Object

Combo Box

(41)

Building Control Object

List Box

List boxes provide the user with a scrollable list that contains a number of options or pieces of

(42)

Building Control Object

Page Frame

A page frame is a container object that contains pages, which can contain controls.

(43)

Building Control Object

Image

is a graphical control that displays bitmaps that can't be changed directly.

(44)

Building Control Object

Timer

A typical use for the timer is checking the system clock to determine if it is time to run a program or

(45)

Basic Codes of Fox Pro

ADD

select item2

append blank

thisform.txticode.setfocus

thisform.refresh

(46)

Basic Codes of Fox Pro

Save

With thisform

Select item2

Append blank

Replace icode with thisform.txtcode.value

Thisform.refresh

(47)

Basic Codes of Fox Pro

Delete

WITH thisform

select item2

delete

thisform.refresh

ENDwith

(48)

Basic Codes of Fox Pro

Search

LOCATE for Icode=ALLTRIM(thisform.textsearch.value)

IF FOUND() then

MESSAGEBOX("Icode found")

thisform.txtIcode.Value=Icode

thisform.txtScode.Value=Scode

thisform.txtDescri.Value=Descri

thisform.txtPrice.Value=Price

thisform.search.Value=""

ELSE

MESSAGEBOX("Icode not Found")

ENDIF

(49)

Basic Codes of Fox Pro

Next Button

select item2

if !eof() then

skip+1

thisform.refresh

else

messagebox("end of Records")

goto top

thisform.refresh

endif

(50)

Basic Codes of Fox Pro

Back Button

select item2

if !bof() then

skip-1

thisform.refresh

else

messagebox("beggining of Records")

goto top

thisform.refresh

endif

(51)

Simple Activity

1. Create new project and name it pos

2. Create form name as activity

3. Create table name as Item

4. Input fields:

1. Icode

character

3

2. Scode

character

2

3. Descri character

15

4. Price

numeric

4

decimal: 2

3. Design the GUI

4. Command buttons:

1. Add

2. Save

3. Search

4. Next

5. Back

5. Place a grid that displays the added item

References

Related documents

Tenses are used in order to refer to the time when an action takes place.. In dealing with tenses, it is important to recall that there are two types of verbs- the regular and

This paper examines the application of Visual Basic Computer Programming Language to Simulate Numerical Iterations, the merit of Visual Basic as a Programming Language and

With the assistance of our valued resource partners ( SCORE, Women’s Business Center, the Missouri Small Business Technology Development Center and the Kansas Small

He was the founder and leader of the NJFIT: Future in Transportation Program, which provided transportation and planning land use assistance to more than 50 communities in New

The aim of this study was to deter- mine HBV genotype and subgenotype through nested PCR based on surface gene and sequencing in patients at the Internal Medicine

Once more assuming full pass-through effect, no substitution effect, no employment effect and no spillover effects, they estimate that a 10% minimum wage increase raises prices

Tidak hanya sebagai editor yang melakukan editing, tetapi di ARTV School of Public Speaking juga menjadi kameraman di kegiatan atau event tertentu, sehingga apa yang penulis

To compensate for small amounts of data, it is com- mon to reduce the temporal resolution of correlation functions, for example by temporal integration or by spike clipping (e.g.,