The following code works - once!
If I try and repeat it I get exception Access violation at 00470FB8 in module 'MyApp.exe'
And have to restart the program to get this procedure to work again - once. Etc. etc.
It only happens if I have ProgressBar code included.
Can someone please throw some light on this?
Procedure TfrmMyForm.btnUpDateClick(Sender: TObject);
var
MyBookmark : TBookmark;
i: SmallInt;
begin
ProgressBar1.Min := 0;
ProgressBar1.Max := 100;
ProgressBar1.Step := 1;
for i := 1 to 100 do
ProgressBar1.Position := i;
with MyTable do
begin
MyBookMark := MyTable.GetBookmark;
MyTable.First;
while not MyTable.Eof do
begin
// Do Wonderful things
ProgressBar1.Stepit;
MyTable.next;
end;
ProgressBar1.Free;
MyTable.enablecontrols;
MyTable.FreeBookMark(MyBookMark) ;
end;[/color]
If I try and repeat it I get exception Access violation at 00470FB8 in module 'MyApp.exe'
And have to restart the program to get this procedure to work again - once. Etc. etc.
It only happens if I have ProgressBar code included.
Can someone please throw some light on this?
Procedure TfrmMyForm.btnUpDateClick(Sender: TObject);
var
MyBookmark : TBookmark;
i: SmallInt;
begin
ProgressBar1.Min := 0;
ProgressBar1.Max := 100;
ProgressBar1.Step := 1;
for i := 1 to 100 do
ProgressBar1.Position := i;
with MyTable do
begin
MyBookMark := MyTable.GetBookmark;
MyTable.First;
while not MyTable.Eof do
begin
// Do Wonderful things
ProgressBar1.Stepit;
MyTable.next;
end;
ProgressBar1.Free;
MyTable.enablecontrols;
MyTable.FreeBookMark(MyBookMark) ;
end;[/color]