Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Foxpro Searching 2

Status
Not open for further replies.

Miss Su

IS-IT--Management
Feb 8, 2019
2
PH
Can anybody teach me on how to create a visual foxpro program that will search from a textbox and it will automatically display in a grid.For example i am searching for the lastname of employee when i enter "SMI" all the "smi" lastname will display in a grid. Thankyou for your response. Im a newbie in foxpro
 
Can anybody teach me on how to create a visual foxpro program that will search from a textbox and it will automatically display in a gri

No. That's not how the forum works. We will be happy to answer specific questions and to try to solve problems. But we don't provide tutorials or teach how to write programs.

I suggest you try to work out the basics for yourself, and come back here when you have a specific question.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
I think you're interpreting that question as far to broad.
There are code samples coming with VFP, you find them in the Task Pane as "Solution Samples", searchable.

And one sample that you might like is in the VFP directory at samples\solution\ffc\datasort.scx
About Sorting and filtering data.

Bye, Olaf.

Olaf Doschke Software Engineering
 
Mike is right. However, to get you off the ground, here is a possible way to populate a grid with selected records from a table.

Suppose you have an open table with the ALIAS customer. The fields of this table include the customer’s name Custname, his Account code, a Postcode and the outstanding Balance on the account.

Create a new form with a textbox txtPrefix, into which the user will enter the first few characters of the customer name (its Format property should be ‘!’ – without the quotes); a command button cmdSearch with caption ‘Search’; and a grid grdresult with its Colcount property set to 4 and its Deletemark set to .F..

Then in the Click() method of cmdSearch, place code something like this :
Code:
LOCAL lPrefix
WITH Thisform
   lPrefix = RTRIM(.txtPrefix.value)
   SELECT Account, Custname, Postcode, Balance ;
         FROM Cus WHERE UPPER(Cus.custname) = lPrefix INTO CURSOR cSubset
   .grdResult.RecordSource = "cSubset"
   .grdResult.Refresh()
   ENDWITH

You could include code after the SELECT statement to check that there was at least one record in the cursor cSubset which you have created.

If the rule for extracting records to be placed in grdresult was a little more complicated, you could equally replace the SELECT-SQL statement above with statements to create an empty cursor and then populate it with a SCAN through the Customer table.

I hope this helps. Good luck Su.

Andrew
 
Dear Sir
this code in object(text1) procedure( interactichange)

SELECT m.stfno as 'EmpNumber',m.name1 as 'First_Name',m.name2 as 'Second_Name',m.name3 as 'Last_Name' FROM MASTER m ;
where ALLTRIM(name1)+" "+ ALLTRIM(name2)+" "+ ALLTRIM(name3)=ALLTRIM(thisform.text1.Value);
ORDER BY 1;
into CURSOR grid1
THISFORM.grid1.RecordSource='grid1'
thisform.grid1.SetAll("DynamicBackColor", ;
"IIF(MOD(RECNO( ), 2)=0, RGB(0,255,255) ;
, RGB(0,255,0))", "Column") && Alternate white and green records
THISFORM.grid1.Visible= .t.
thisform.grid1.FontSize = 10
THISFORM.grid1.Refresh
THISFORM.Refresh


Best Regards
Husean Zghair
 
 https://files.engineering.com/getfile.aspx?folder=d86f9fdb-d7df-4d6b-b9d2-e1962c04cda8&file=grid_search.png
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top