-1
Hello!
I’m trying to change the borderstyle property at the event onCreate
form, but error occurs AccessViolation
, someone knows how I can solve?
My code:
procedure TfmContasPagar.FormCreate(Sender: TObject);
var
RedimensionarTela : String;
begin
RedimensionarTela := TUtil.Sql.SQLLinha('SELECT REDIMENSIONAR_TELA FROM USUARIOS WHERE COD_USUARIO = ' + IntToStr(Codigo_Usuario), Database);
if RedimensionarTela = 'N' then
fmContasPagar.BorderStyle := bsSingle
else
fmContasPagar.BorderStyle := bsSizeable;
end;
Your program has only this functionality?
– Pedro Roweder
No, but I didn’t think it was necessary to put it all here. The error part is this
– R.Gasparin
The Resize screen variable is being declared where? I find it unlikely that the error is in changing Border, unless the scope does not have access to fmContasPagar. Access Violation occurs while trying to access a missing or inaccessible memory address
– Pedro Roweder
But it is that the screen worked normal, when I went to perform this change the error started to occur
– R.Gasparin
Try debugging the code by checking the contents of the variables before and at the time of the error. Keep in mind that Accessviolation occurs due to a missing or improper memory access. Error is not reproducible, which makes it difficult to answer.
– Pedro Roweder
Debuguei, as the variable is returning 'N', it is in this condition that falls:
fmContasPagar.BorderStyle := bsSingle
and that’s when the error occurs– R.Gasparin
Utilizes
Self.BorderStyle
instead of the way you are doing to change the edge– Pedro Roweder
I did as you said, avoided the error, but did not execute the command, did not change the borderStyle
– R.Gasparin
could you enter the code where you are creating the form Tfmcontaspagar ? The variable fmContasPagar refers to Tfmcontaspagar?
– Rafael Dal bosco