Grid - Pre Sale Questions
EConvertError
Thread Starter: Jakem Schott Started: 10/21/2007 12:09 PM UTC
Replies: 4
EConvertError

Hello

I am doing something wrong when I use the grid and assign values to it programmatically. When I use the grid where when the grid is loaded and it is empty I can change the values from numerical data to string data and there is no issue. But when I load data into the grid from values I have stored in my database I am getting a convert error

"Econvert error with message "somestring" is not a valid integer"

The way I am populating the grid is as follows:

ProfGrid1.Cells[ColCount, RowCount].Value := DataModule1.ListClassSource.DataSet.FieldByName('Result').AsVariant;

The Result field in my database is an integer, so it must be picking it up from there?

Any suggestions

 

Thanks

Jake

 

Re: EConvertError
"Econvert error with message "somestring" is not a valid integer"

ProfGrid1.Cells[ColCount, RowCount].Value := DataModule1.ListClassSource.
DataSet.FieldByName('Result').AsVariant;

Try AsInteger because Variant and Integer are two completely different types.

If you have purchased ProfGrid please ask your questions in the profgrid.grid.support newsgroup.

Fons (just a ProfGrid user)
Re: EConvertError

No I haven't purchased profgrid as of yet, but all signs are pointing to the fact that I will if I can sort out these remaining few problems I have. I tried the AsInteger option, but this still throws an exception when a string is entered, as I do not know the type of data that will be entered I want to be able to handle any data type, this seems to be ok with the profgrid, but when I programmatically change the value of the cell I must change the default datatype of the cell therefore how do I change the value of a cell programmatically and still except all types of data to this cell if changed

Thanks

Jake

Re: EConvertError
Hello Jakem,

Please include a small sample project (source + exe) that illustrates the problem you have.


-Nicholas
Re: EConvertError

Hello Nicholas and Fons

Thanks for the responses, I think I may have worked around my problem rather than solved it. I deleted my original profgrid component and placed a new profgrid component into my application and left the code the same and now everything seems to be ok.

Thanks for the help

Jake