Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Danson Danson
  Where is Danson Danson?
 Nairobi
 Kenya
 Danson Danson
 To: Stefan Wuebbe
  Where is Stefan Wuebbe?
 Hamburg
 Germany
 Stefan Wuebbe
 Tags
Subject: RE: Grid in VFP 9.0
Thread ID: 233127 Message ID: 233210 # Views: 27 # Ratings: 0
Version: Visual FoxPro 9 Category: Grids
Date: Tuesday, June 30, 2009 4:14:34 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

Thanks Stefan, the code worked perfectly....thanks alot and God bless you
But i have another problem,
1. What is the best way to sum numeric values in a grid eg i have a grid called grid1 with six columns: No, name, marks1, marks2, total,and grade.
I want to sum values of 'marks1' and 'marks2' and store them in 'total' and then grade the total and store the text value like "pass" or "fail" in 'grade' column

2. When am grading the value in the 'total' column i also need to check if columns 'marks1' and 'marks2' have values or are empty and then grade the total based on this. In other words, if the student did not sit for one of the exam, that means either 'marks1' or 'marks2' is empty, then the grade should be "Course not complete". I hope you got it. Thanks.

Danson



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