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 8392611
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:33:29+00:00 2026-06-09T19:33:29+00:00

How can I suppress to close the form when hitting the OK button? I

  • 0

How can I suppress to close the form when hitting the OK button? I have the following code:

void __fastcall TfrmTillegg_velg::btnOkClick(TObject *Sender)
{
    if (exp1)
        ShowMessage("Not allowed"); // Don't close form
    else if (exp2)
        ShowMessage("Not allowed"); // Don't close form
    else
    {
        // Do something here
        Close();
    }
}

The project is written in Borland c++builder.

  • 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-09T19:33:30+00:00Added an answer on June 9, 2026 at 7:33 pm

    If you mean keeping the dialog created by ShowMessage open. then as far as I am aware, you cannot do this. The dialog displayed by ShowMessage will close whenever you click any of its buttons. If you want a popup dialog that will not close in this way, you will need to create a custom form yourself and control its behaviour according to your needs.

    Just in case your question is referring to your main form closing, then you do have an explicit call to Close() within your button click event handler above that will cause your form to close whenever both of your exp1 and exp2 conditions are false.

     else     {         
            // Do something here         
            Close();     // THIS WILL CLOSE YOUR MAIN FORM.
     } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have the following code, and i want to know how can supress the
I have read that I can suppress this noise by defining a form accept
Can someone thoroughly explain the last line of the following code: def myMethod(self): #
I have the following code that generates a compiler error: Boolean IConvertible.ToBoolean(IFormatProvider provider) {
In the following LaTeX fragment, how can I suppress the newline that is automatically
How can I suppress hyphens (------------) from the results set of this sqlcmd command:
How can i suppress words in a DIV (which has a defined width and
I need to suppress a specfic compiler warning in C#. Now I can do
Can I order my users in the database, so I don't have to say
Can we change the default action of the edit selected row button? Here is

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.