Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

EAccessViolation

I have MDI Form that contains 2 Forms inside. both of them I set its windowstate to wsMaximized. if I want to bring second form to front, I call Form2.BringtoFront, so does the first form ( form1.BringtoFront ). Sometimes I get no problem n it works fine. But Sometimes I get an error of EAccessViolation. I try to solve this problem with :
procedure TForm1.SetToFront;
begin
try
form1.BrintoFront;
except on EClassViolation do
form1.SetToFront;
end;
end;
but this can't solve the problem. Any suggestion for this ?

thanks in advance

Comments

  • zibadianzibadian Posts: 6,349Member
    : I have MDI Form that contains 2 Forms inside. both of them I set its windowstate to wsMaximized. if I want to bring second form to front, I call Form2.BringtoFront, so does the first form ( form1.BringtoFront ). Sometimes I get no problem n it works fine. But Sometimes I get an error of EAccessViolation. I try to solve this problem with :
    : procedure TForm1.SetToFront;
    : begin
    : try
    : form1.BrintoFront;
    : except on EClassViolation do
    : form1.SetToFront;
    : end;
    : end;
    : but this can't solve the problem. Any suggestion for this ?
    :
    : thanks in advance
    :
    It could be that one of the Controls on the form is in an invalid state, or perhaps one of your data objects is nil, while the redraw of the form depends on it.
    The only way to find out what is happening, is to look if there is a certain condition, which causes the error. In other words can you put the program in a state that the error occurs each time? This kinds of errors usually don't appear at random.

  • smile032smile032 Posts: 43Member
    : : I have MDI Form that contains 2 Forms inside. both of them I set its windowstate to wsMaximized. if I want to bring second form to front, I call Form2.BringtoFront, so does the first form ( form1.BringtoFront ). Sometimes I get no problem n it works fine. But Sometimes I get an error of EAccessViolation. I try to solve this problem with :
    : : procedure TForm1.SetToFront;
    : : begin
    : : try
    : : form1.BrintoFront;
    : : except on EClassViolation do
    : : form1.SetToFront;
    : : end;
    : : end;
    : : but this can't solve the problem. Any suggestion for this ?
    : :
    : : thanks in advance
    : :
    : It could be that one of the Controls on the form is in an invalid state, or perhaps one of your data objects is nil, while the redraw of the form depends on it.
    : The only way to find out what is happening, is to look if there is a certain condition, which causes the error. In other words can you put the program in a state that the error occurs each time? This kinds of errors usually don't appear at random.
    :
    :

    oh I'm thinking of my first form has an udp control that always active for receiving data. I've tried to find how to disable the udp control, but I found nothing. How can I deactivate or re-activate an udp control? like the tcp one, I can activate or deactivate it by the active property, but how about the udp one? may be this is the problem..
  • zibadianzibadian Posts: 6,349Member
    : : : I have MDI Form that contains 2 Forms inside. both of them I set its windowstate to wsMaximized. if I want to bring second form to front, I call Form2.BringtoFront, so does the first form ( form1.BringtoFront ). Sometimes I get no problem n it works fine. But Sometimes I get an error of EAccessViolation. I try to solve this problem with :
    : : : procedure TForm1.SetToFront;
    : : : begin
    : : : try
    : : : form1.BrintoFront;
    : : : except on EClassViolation do
    : : : form1.SetToFront;
    : : : end;
    : : : end;
    : : : but this can't solve the problem. Any suggestion for this ?
    : : :
    : : : thanks in advance
    : : :
    : : It could be that one of the Controls on the form is in an invalid state, or perhaps one of your data objects is nil, while the redraw of the form depends on it.
    : : The only way to find out what is happening, is to look if there is a certain condition, which causes the error. In other words can you put the program in a state that the error occurs each time? This kinds of errors usually don't appear at random.
    : :
    : :
    :
    : oh I'm thinking of my first form has an udp control that always active for receiving data. I've tried to find how to disable the udp control, but I found nothing. How can I deactivate or re-activate an udp control? like the tcp one, I can activate or deactivate it by the active property, but how about the udp one? may be this is the problem..
    :
    I don't think so, but you could try by making a back-up of you project and let it run without the udp control and all dependent code.
Sign In or Register to comment.