Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Mayur Subbu
  Where is Mayur Subbu?
 Bangalore
 India
 Mayur Subbu
 To: mut jayan
  Where is mut jayan?
 chennai
 India
 mut jayan
 Tags
Subject: RE: Records not shown in grid
Thread ID: 228730 Message ID: 228849 # Views: 2 # Ratings: 0
Version: Visual FoxPro 9 Category: Grids
Date: Friday, May 22, 2009 4:31:12 AM         
   


> I have create two forms namely 1. empmain.scx 2. search.scx, in empmain form I have entered new employee records only in that i have put one grid control, and five text boxes and three command button. when I run the form all the records displayed in grid. I have click search command button in empmain.scx the search form will open and i have find some records and again i have come back to empmain form the records not display in the grid control.
>
> 1. code of the empmain.scx is below
>
> use "D:\centac\emp.dbf"
> locate for (thisform.txtappno.value) = appno
> if NOT found()
> INSERT INTO centac values(thisform.txtappno.value, thisform.txtadd1.value, thisform.txtadd2.value, thisform.txtadd3.value, thisform.txtadd4.value,;
> thisform.combo1.value, thisform.combo2.value, thisform.txtddno.value, thisform.txtbank.value, VAL(thisform.txtamount.value), thisform.txtdate.value)
> thisform.grid1.refresh
> ELSE
> Messagebox("APPLNO ALREADY EXISTS")
> endif
> thisform.txtappno.value = ""
> thisform.txtadd1.value = " "
> thisform.txtadd2.value = " "
> thisform.txtadd3.value = " "
> thisform.txtadd4.value = " "
> thisform.txtddno.value = " "
> thisform.txtbank.value = " "
> thisform.txtamount.value = " "
> thisform.txtappno.setfocus
>
> 2. code of the seach is below
>
> use "D:\centac\emp.dbf
> if thisform.optiongroup1.option1.value = 1
> locate for thisform.txtsearch.value = ddno
> if found()
> Messagebox("RECORD FOUND")
> ELSE
> Messagebox("RECORD NOT FOUND")
> ENDIF
> thisform.txtsearch.value = " "
> thisform.txtsearch.setfocus
> ELSE
> if thisform.optiongroup1.option2.value =1
> lctext = alltrim(upper(this.parent.txtsearch.value))
> select * from centac where upper(address1) like lctext+'%'
> endif
> ENDIF
> thisform.txtsearch.value = " "
> thisform.txtsearch.setfocus
>
> How to rectify the problem?
>
> Awaiting yours reply.
>
>
> Hi Jayan,
>
> You may try what Stefan has suggested in his post.

Another way is, in the Load() event of empmain.scx create a Cursor with the same table structure as emp.dbf. Also create an index on the field your search expression lies by issuing
Index on ddno tag ddno
assuming that U are seeking DDNo. Set the recordesource property of the Grid to the cursor you have created. In the init event of empmain.scx select the records from emp.dbf using Select into clause.
You may create a Custommethod in the empmain called Setgrid() where U can set the recordsorce, column headers etc and refresh() the grid too. Another little feature that I use in such cases in the Setall() method to change the color of the searched record, if found.

So far so good. In the interactivechange() event of the textbox of the search form, call a custom method say SearchString(). In the SearchString method, capture the textbox value in a local variable, set The index and issue the Seek() command and refresh the Grid by calling the Setgrid() method.

Well if you let me know your emailid I can mail the sample forms.

Mayoor.
> Save to: Default
>
>
>
>
>
> Switch color theme
> Select message background color...
> Select message area width...
> Adjust message text font size...
> Disable auto links
> Enable acronyms
> Disable message header
> Enable auto quote
> Update the title of this thread...
> Grid Thread #1401196 Message #1401196

ENTIRE THREAD

Records not shown in grid Posted by mut jayan @ 5/21/2009 7:19:23 AM
RE: Records not shown in grid Posted by Ammar Hadi @ 5/21/2009 8:02:30 AM
RE: Records not shown in grid Posted by Stefan Wuebbe @ 5/21/2009 9:56:51 AM
RE: Records not shown in grid Posted by Mayur Subbu @ 5/22/2009 4:31:12 AM