Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9264141
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T13:45:09+00:00 2026-06-18T13:45:09+00:00

So here is my situation. I have a Form (MainMenu) and a Frame (TestFrame).

  • 0

So here is my situation. I have a Form (MainMenu) and a Frame (TestFrame). TestFrame is displayed on a TPanel located on MainMenu. Using this code:

frTestFrame := TfrTestFrame.Create(nil);
frTestFrame.Parent := plMain;
frTestFrame.Align := alClient;
frTestFrame.Visible := true;

TestFrame displays fine with no error. TestFrame has a few TEdit boxes on it. A TButton on MainMenu calls a procedure located in TestFrame to check if the TEdit boxes text property is null.

procedure TfmMainMenu.tbCheckClick(Sender: TObject);
begin
frTestFrame.Check;
end;

This function on TestFrame is supposed to go through all the “TEdit” components and use the function GetErrorData that returns a string if the TEdit’s text property is null. That string is added to a TStringList and displayed if any TEdit boxes are null.

function TfrTestFrame.Check: Boolean;
var
 ErrorList: TStringList;
 ErrorString: string;
 I: Integer;
begin
 ErrorList := TStringList.Create;
 for I := 0 to (frTestFrame.ComponentCount - 1) do
begin
  if (frTestFrame.Components[I] is TEdit) then
    begin
      ErrorString := GetErrorData(frTestFrame.Components[I]);
      if (ErrorString <> '') then
        begin
          ErrorList.Add(ErrorString);
        end;
    end;
end;
if (ErrorList.Count > 0) then
begin
  ShowMessage('Please Add The Following Information: ' + #13#10 + ErrorList.Text);
  result := false;
end;
result := true;
end;

function TfrTestFrame.GetErrorData(Sender: TObject): string;
var
 Editbox: TEdit;
 ErrorString: string;
begin
if (Sender is TEdit) then
 begin
   Editbox := TEdit(Sender);
   if (Editbox.Text <> '') then
     begin
       Editbox.Color := clWindow;
       result := '';
     end
   else
    begin
      Editbox.Color := clRed;
      ErrorString := Editbox.Hint;
      result := ErrorString;
    end;
end;
end;

The problem is that when it hits the line “for I := 0 to (frTestFrame.ComponentCount – 1) do
” It blows up and I get the error “Access violation at 0x00458… Read of address 0x000…”
I do not know why this error is happening. I can only assume that maybe the Frame is not getting creating. Any help would be great. Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T13:45:10+00:00Added an answer on June 18, 2026 at 1:45 pm

    According to your question, the line

    for I := 0 to (frTestFrame.ComponentCount - 1) do
    

    leads to an access violation at address 0x000..... Now, for a start, why won’t you tell us the precise error message with the full details? Hiding the address makes it harder!

    Anyway, it looks like the address is going to be a value very close to zero. In any case the only explanation for an access violation there is that frTestFrame is invalid. Most likely it is nil.

    I note that the code in question is inside a TfrTestFrame method. So why do you use frTestFrame to refer to the object? You are already inside an instance of the object. Do you have multiple global variables named frTestFrame? Perhaps one in the main form unit and one in the frame unit?

    You should stop using global variables for your GUI objects. I know that the IDE leads you that way. Resist the temptation to program that way. Abuse of global variables leads to pain and suffering.

    Since the code is inside a TfrTestFrame method you can use Self. In all your TfrTestFrame methods remove all references to frTestFrame. Your loop should be like this:

    for I := 0 to ComponentCount - 1 do
    

    and the rest of the methods in that class need similar treatment. Note that you don’t need to explicitly write Self and it is idiomatic not to.

    Finally, I urge you to learn how to use the debugger. It’s a wonderful tool and if you would use it, it would have told you what the problem was. Don’t be helpless, let the tools help you.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple situation here. lets face html code first => <form name=geoKey
Here is the situation: I have a webservice that returns a form. This form
I have a unique situation over here. I have a button on a form
I have this situation: a Form with a System.Timer in it (with AutoReset =
I'm having a bit of a weird situation here. I have a form that
Okay here's my situation. I have a php file that contains a simple form
Here is the situation : I have a form created by HtmlService, and several
Here's my situation: i have a dialog form that inserts some data on my
Right, here's my situation, I have a form on a page (index.jsp) which submits
We are using struts 1.2.2 and have a situation here. So we have 2

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.