Bug in Samples " Edit "

Questions and answers on how to use XLSReadWriteII 3/4/5.
Post Reply
steven2009
Posts: 3
Joined: Wed Apr 25, 2012 12:04 pm

Bug in Samples " Edit "

Post by steven2009 »

Hello larsa
I was studying the sample files. And i found that the "Edit" sample have a bug. While runing the "Edit" sample, if the sheet cell is empty, and when click it, it show an error "raised exception class EConvertError with message ''' is not a vaild floating point value." I found the error in the code was appearing in

procedure TForm1.GridSelectCell(Sender: TObject; ACol, ARow: Integer; var CanSelect: Boolean);
begin
.....
if (EditCol = Grid.Col) and (EditRow = Grid.Row) then
SetCellValue(Grid.Col - 1,Grid.Row - 1);
end;

Could you please tell me how to solve this problem. Thank you.
larsa
Site Admin
Posts: 926
Joined: Mon Jun 27, 2005 9:30 pm

Re: Bug in Samples " Edit "

Post by larsa »

Hello

It's not an error. The exception occures only when your app is running from delphi. Read the code more carefully. If you don't like it, you can replace StrToFloat withTryStrToFloat.
Lars Arvidsson, Axolot Data
steven2009
Posts: 3
Joined: Wed Apr 25, 2012 12:04 pm

Re: Bug in Samples " Edit "

Post by steven2009 »

[quote="larsa"]Hello

It's not an error. The exception occures only when your app is running from delphi. Read the code more carefully. If you don't like it, you can replace StrToFloat withTryStrToFloat.[/quote]

Thank you larsa, i have solved this problem, but not in your methods. I used directly judgement "if ... else ..." in procedure SetCellValue, and drop the "try... except...". I think the problem cames from the indefinite cell keypress formation, because if edittext is all numbers it would be OK, but letter would be error. So i use directly judgement and solve the problem completely.
Post Reply