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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:45:56+00:00 2026-05-26T15:45:56+00:00

I have a custom made dialog winform. On it I have a label, textbox

  • 0

I have a custom made dialog winform. On it I have a label, textbox and 2 buttons (OK and Cancel). It also declares and defines overloaded execute methods for passing different parameter list.

Dialog Winform is called as follows:

var theDialog := new InputMsgBox;

if theInputB.Execute('Awesome StackOverflow','Enter Text?',s,var s) = DialogResult.OK then
begin
  Invalidate;
  SetText(s);
end;

Dialog Winform execute is defined as follow:

method InputMsgBox.Execute(Title, theMessage, defaultanswer:string;var thevalue:string): DialogResult;
begin
    result := DialogResult.Cancel;

    Requesttext.Text:=themessage;
    Requesttext.Enabled:=true;
    Requesttext.Visible:=true;
    InputTextBox.Text:=defaultanswer;
    InputTextBox.Enabled:=true;
    InputTextBox.Visible:=true;

    CancelBtn.Enabled:=true;
    CancelBtn.Visible:=true;
    Okbtn.Enabled:=true;
    Okbtn.Visible:=true;

    self.ShowDialog;
    Result := self.DialogResult;
    thevalue:=InputTextBox.Text;
end;

When execute method returns back to the caller, it always returns DialogResult.Cancel even when you click on OKBtn.

The Buttons’ dialogresult are set accordingly.

I have set the AcceptButton and CancelButton on the Dialog winform.

I can’t figure out why the showdialog method is always returning DialogResult.Cancel.

UPDATE After doing some test, I found out that my other custom-made dialog window works fine when display by calling showdialog = DialogResult.Ok. So, I checked both of them to see if there are some differences in their properties setting and there is absolutely no difference. I don’t understand it.
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-05-26T15:45:57+00:00Added an answer on May 26, 2026 at 3:45 pm

    I figured out my problem. This is why Dialog Form always returned Cancel DialogResult. For my custom-made dialog window, I also implemented Form_Closing event method. Apparently, you are not to have an event that will jump the program counter out of its steps when opening a dialog using ShowDialog method. So, it was already closed before it got a chance to read its DialogResult. Therefore, my program only saw the default DialogResult for my Dialog Window.

    Once I removed the Form_Closing event method, it is working the way it is supposed to.

    Instead of deleting the question, I am answering it and I feel it will help others.

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

Sidebar

Related Questions

I have some custom made dialog that have on it Set Button , I
I have made the custom dialog for my application. @Override public void onCreate(Bundle savedInstanceState)
Here's what I have: Custom-made C# CMS where the content is stored in a
I have a custom-made view that extends the View class. I would like 2
I have a custom module I made for Magento. From the admin, there is
I have a custom module I made to show featured products on the homepage.
I have made a custom UserControl i Vb.net (windows application). How can I add
I have made a custom formwizard and incorporated it into my admin interface. Basically
Coming from this question , I have a wxComboCtrl with a custom popup made
I made a custom handler that derives from MvcHandler. I have my routes using

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.