In this article I would like to share with you a simple program that I wrote using Microsoft Visual Foxpro 9 to demostrate CRUD application it can add, edit, delete, view, print and search it is can generate reports and have error correction capability. I hope you will learn something in my program.
I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.
About Page
Report Generation and Preview
Table Structure
Sample Records in the Table
Program Listing
Search Button
=============
SELECT demo
thisform.txtT_id.Enabled = .T.
thisform.txtT_id.ReadOnly = .F.
IF  Empty(thisform.txtT_id.Value)
   MESSAGEBOX("Please provide ID Number." + CHR(13) + " Please try again.",0+48,"Reminder")
    thisform.txtT_id.Value=""
    thisform.txtT_id.SetFocus
   ENDIF
LOCATE FOR t_id = m.t_id
IF FOUND() 
   thisform.txtT_name.Enabled = .T.
   thisform.txtT_id.Value = t_id
   thisform.txtT_name.Value = t_name
   thisform.Refresh
  ELSE 
    Messagebox("Record not found Try Again",32,"Reminder") 
    thisform.txtT_id.value = 0
    thisform.txtT_name.value=""
    thisform.txtT_name.Enabled = .F.
    thisform.txtT_id.SetFocus
endif
New button
==========
m.t_id =RECCOUNT()+1
m.t_name=""
thisform.Refresh
thisform.txtT_id.ReadOnly = .T.
thisform.txtT_name.Enabled = .T.
Save Button
===========
select demo
locate for t_id = m.t_id
if !found()
   && new record
   if Messagebox("Are you sure to add new record?",32+4,"Confirmation") = 6
   append blank  && add new record
   gather memvar
  endif
 else && update record
       if Messagebox("Are you sure to update existing record?",32+4,"Confirmation") = 6
       gather memvar && overwrite existing record
     endif
  endif
  thisform.grdDemo.refresh
  Delete Button
  =============
 select demo
SET DELETED on
locate for t_id = m.t_id
if found()
   if Messagebox("Are you sure to delete this record?",32+4,"Confirmation") = 6
   delete
  endif
 ENDIF
  m.t_id=""
  m.t_name=""
  thisform.refresh
  thisform.grdDemo.refresh
  thisform.txtT_id.Enabled= .F.
  thisform.txtT_name.Enabled= .F.
  thisform.command1.SetFocus
  Print Button
  ===========
select demo
report form demo to printer prompt preview
Close Button
============
thisform.Release







Nice to have details about search button, new button, save button, delete button, print button and close button.
ReplyDeleteVisual FoxPro to .Net and FoxPro to .Net