Jump to content


Photo

LoadFromCSV not working


  • Please log in to reply
2 replies to this topic

#1 fanki

fanki
  • Members
  • 2 posts

Posted 11 February 2025 - 04:48 PM

Hi all,

 

I'm new to NextGrid. It seems that it is rather different from StringGrid and AdvStringGrid (TMS Software) I used so far.

 

I try to load a csv file with 29 columns and 5062 rows. I get an out of bounds (-1) error when I load it with NextGrid61.Serialize.LoadFromCSV.

My code:

NextGrid61.Serialize.SeparatorChar := ';';
   NextGrid61.Serialize.Encoding := ekAnsi;
   for i := 1 to 29 do
      begin
        NextGrid61.Columns.Add(TNxNumberColumn6, 'Test', 'T');
        NextGrid61.Cells[i-1, 0] := IntToStr(i); {test to assign values to cells}
      end;
   ShowMessage('ColCount: ' + IntToStr(NextGrid61.ColCount) + ' Colums.Count: ' + IntToStr(NextGrid61.Columns.Count));
   //NextGrid61.AddRow(5062);
   NextGrid61.RowCount := 5062;
   for i := 1 to NextGrid61.RowCount do
      NextGrid61.Cells[0, i-1] := IntToStr(i);  {test to assign values to cells}
   NextGrid61.Serialize.LoadFromCSV('C:\Data\test.csv');

Isn't it possible to load a csv file without knowing number of columns and rows? If the separator is set it should be possible to load the file automatically without knowing number of columns and rows beforehand.

 

I could not find a demo project using LoadFromCSV. That suprized me because loading data from a text file into a grid seems to me a basic task.

Is there no other documentation than the user guide, "tipps and tricks" and the source code?

 

I would be glad to see an example how to use it.

 

Thanks!

 

 



#2 fanki

fanki
  • Members
  • 2 posts

Posted 12 February 2025 - 02:00 AM

Ok, over another topic I found the following link: https://help.bergsoft.net/.



#3 Boki (Berg)

Boki (Berg)

    Boki (Berg)

  • Forum Admin
  • PipPipPipPipPip
  • 8,236 posts
  • Gender:Male

Posted 12 February 2025 - 09:15 PM

Hi,

 

Probably this topic and property may help you:

https://help.bergsof...ization/Options


boki@bergsoft.net | LinkedIn Profile
--
BergSoft Home Page: www.bergsoft.net
Users Section: users.bergsoft.net
Articles and Tutorials: help.bergsoft.net (Developers Network)
--
BergSoft Facebook page
--
Send us applications made with our components and we will submit them on: www.bergsoft.net/apps.htm. Link to this page will be also set on home page too.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users