Jump to content


Photo

Access Violation on ColumnName.Index


  • Please log in to reply
3 replies to this topic

#1 BelangerC

BelangerC

    Senior Member

  • Members
  • PipPip
  • 221 posts
  • Location:Richmond, CA USA
  • Interests:Alternative medicine, programming for

Posted 06 March 2023 - 02:36 PM

Hi, Boki:

 

I have never seen this before. Created new NextGrid6, Added 3 columns via the editor, renamed the columns, but on code:

 

(I tried to delete everything and start over and still had the same problem. It is failing on:

function TNxColumn6.GetIndex: Integer;
begin
  if Assigned(Columns) then Result := Columns.IndexOf(Self) <=== This Line causes AV. During runtime. Columns is not available.
    else Result := -1;
end;)
 
Anything I am doing wrong?
Thank you,
Chuck
 
My code;
 
with dlgVideoFiles do
begin
 if Execute then
 begin
   //fill grid with selected files
   gridFiles.BeginUpdate();
   gridFiles.clear;
   gridFiles.AddRow(Files.count);
 
   for i := 0 to Files.Count-1 do
   begin
   with gridFiles do
   begin
     ACol := NxTextFilePath.Index; <== I did this to isolate the Column.Index evaluation, getting AV on evaluation of NxTextFilePath.Index.
     Cell[ACol,i].asString := ExtractFilePath(dlgVideoFiles.Files[i]);
     ACol := NxTextFileName.Index;
     Cell[ACol,i].asString := ExtractFileName(dlgVideoFiles.Files[i]);
   end;
   end;
   gridFiles.EndUpdate();
 end;
end;


#2 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 06 March 2023 - 04:45 PM

Hi,

 

I think that the issue is with line grdFiles.Clear

 

In this case, ClearRows need to be used:

http://help.bergsoft...Grid6/ClearRows

 

I hope that this helps!


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.

#3 BelangerC

BelangerC

    Senior Member

  • Members
  • PipPip
  • 221 posts
  • Location:Richmond, CA USA
  • Interests:Alternative medicine, programming for

Posted 06 March 2023 - 09:55 PM

That was it. 

Thank you!

 

Still working with NextGrid5, thus the erroneous overlap.

My next project on my big program that I maintain is to move all the NextGrid5 to NG6. At some point I may need your help as I move NG5 functionality to NG6.

This project is just for my hobby, i.e. collecting videos. Found that some of the downloads are corrupted. This project tests the files for corruption using ffmpeg.exe, a command line program.



#4 Boki (Berg)

Boki (Berg)

    Boki (Berg)

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

Posted 06 March 2023 - 11:31 PM

Glad that it worked,

 

You can ask whenever you want for help :)


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