Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Hamburg
 Germany
 Stefan Wuebbe
 To: Danson Danson
  Where is Danson Danson?
 Nairobi
 Kenya
 Danson Danson
 Tags
Subject: RE: Grid in VFP 9.0
Thread ID: 233127 Message ID: 233194 # Views: 31 # Ratings: 0
Version: Visual FoxPro 9 Category: Grids
Date: Tuesday, June 30, 2009 3:17:47 PM         
   


> Hi Stefan,
> Thanks alot,
> i have a form with a grid eg grid1. In the click prodedure of grid1 in column4, i have this code.
>
> WITH THISFORM
> DO CASE
> CASE .grid1.column3.text1.value>80
> thisform.grid1.column4.text1.value="Distinction"
>
> CASE .grid1.column3.text1.value>=70
> thisform.grid1.column4.text1.value="Credit"
>
> CASE .grid1.column3.text1.value>=55
> thisform.grid1.column4.text1.value="pass"
>
> CASE .grid1.column3.text1.value<55
> thisform.grid1.column4.text1.value="Fail"
> ENDCASE
> ENDWITH
>
> The code is working well, but when i move to the next cell in the next row, the value of the upper cell is inserted into this new cell and not a new value eg a new grade. The grade should change depending on the value of marks in a given cell
>

I'd suggest not to use a Click() event for that, try the following in your Grid1.Column3.Text1.Valid() (Replace "yourResultField" in the code with your desired field name, i.e. the column4.ControlSource):

	LOCAL lnResult
	lnResult = This.Value
	REPLACE NEXT 1 yourResultField With ICASE( ;
			m.lnResult > 80, 'Distinction', ;
			m.lnResult >= 70, 'Credit', ;
			m.lnResult >= 55, 'pass', ;
			m.lnResult < 55, 'Fail', ;
			'n/a' ) IN This.Parent.Parent.RecordSource




hth
-Stefan



COMPLETE THREAD
Grid in VFP 9.0 Posted by Danson Danson @ 6/30/2009 8:30:07 AM
RE: Grid in VFP 9.0 Posted by kulwant singh @ 6/30/2009 9:26:03 AM
RE: Grid in VFP 9.0 Posted by Danson Danson @ 6/30/2009 1:54:41 PM
RE: Grid in VFP 9.0 Posted by Stefan Wuebbe @ 6/30/2009 9:58:13 AM
RE: Grid in VFP 9.0 Posted by Danson Danson @ 6/30/2009 11:32:07 AM
RE: Grid in VFP 9.0 Posted by Stefan Wuebbe @ 6/30/2009 3:17:47 PM
RE: Grid in VFP 9.0 Posted by Danson Danson @ 6/30/2009 4:14:34 PM
RE: Grid in VFP 9.0 Posted by Stefan Wuebbe @ 6/30/2009 5:10:05 PM
RE: Grid in VFP 9.0 Posted by ron philippo @ 7/1/2009 7:39:00 PM
RE: Grid in VFP 9.0 Posted by Stefan Wuebbe @ 7/1/2009 7:50:40 PM
RE: Grid in VFP 9.0 Posted by Anders Altberg @ 6/30/2009 10:09:52 AM