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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T09:59:05+00:00 2026-05-29T09:59:05+00:00

I have a C# app where I’m using Messagebox.Show with a help button, as

  • 0

I have a C# app where I’m using Messagebox.Show with a help button, as per Microsoft’s example at http://msdn.microsoft.com/en-us/library/szwxe9we.aspx

I add the event to the form, but pressing the help button never fires the event – pressing F1 on the form DOES however. Even taking Microsoft’s example almost completely does not fire the event. The whole code is below. Any ideas what I’m not doing?

There is another post where someone had noticed the same.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication4
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            DialogResult r = AlertMessageWithCustomHelpWindow();
        }
        // Display a message box with a Help button. Show a custom Help window
        // by handling the HelpRequested event.
        private DialogResult AlertMessageWithCustomHelpWindow()
        {
            // Handle the HelpRequested event for the following message.
            this.HelpRequested += new System.Windows.Forms.HelpEventHandler(this.Form1_HelpRequested);

            this.Tag = "Message with Help button.";

            // Show a message box with OK and Help buttons.
            DialogResult r = MessageBox.Show("Message with Help button.",
                                              "Help Caption", MessageBoxButtons.OK,
                                              MessageBoxIcon.Question,
                                              MessageBoxDefaultButton.Button1,
                                              0, true);

            // Remove the HelpRequested event handler to keep the event
            // from being handled for other message boxes.
            this.HelpRequested -= new System.Windows.Forms.HelpEventHandler(this.Form1_HelpRequested);

            // Return the dialog box result.
            return r;
        }

        private void Form1_HelpRequested (System.Object sender, System.Windows.Forms.HelpEventArgs hlpevent)
        {
            // Create a custom Help window in response to the HelpRequested event.
            Form helpForm = new Form();

            // Set up the form position, size, and title caption.
            helpForm.StartPosition = FormStartPosition.Manual;
            helpForm.Size = new Size(200, 400);
            helpForm.DesktopLocation = new Point(this.DesktopBounds.X +
                                                  this.Size.Width,
                                                  this.DesktopBounds.Top);
            helpForm.Text = "Help Form";

            // Create a label to contain the Help text.
            Label helpLabel = new Label();

            // Add the label to the form and set its text.
            helpForm.Controls.Add(helpLabel);
            helpLabel.Dock = DockStyle.Fill;

            // Use the sender parameter to identify the context of the Help request.
            // The parameter must be cast to the Control type to get the Tag property.
            Control senderControl = sender as Control;

            helpLabel.Text = "Help information shown in response to user action on the '" +
                              (string)senderControl.Tag + "' message.";

            // Set the Help form to be owned by the main form. This helps
            // to ensure that the Help form is disposed of.
            this.AddOwnedForm(helpForm);

            // Show the custom Help window.
            helpForm.Show();

            // Indicate that the HelpRequested event is handled.
            hlpevent.Handled = true;

        }


    }
}
  • 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-29T09:59:06+00:00Added an answer on May 29, 2026 at 9:59 am

    Take the line

    DialogResult r = AlertMessageWithCustomHelpWindow();
    

    out of the Form1 constructor – maybe put it in a button click handler on the main form. It looks like you’re blocking the UI thread with MessageBox.Show() stopping the help dialog displaying.

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

Sidebar

Related Questions

for example: I have app A, which references library A and library B. in
I have app widget with TextView in it. <FrameLayout xmlns:android=http://schemas.android.com/apk/res/android android:orientation=vertical android:layout_width=fill_parent android:layout_height=fill_parent >
I have app.config in m win application, and loggingConfiguration section (enterprise library 4.1). I
I have an app using PHP and the PayPal API. The basic way it
I have my app engine project myproject.appspot.com hosted at myprojectsdomain.com. I want to permanently
Lets say I have a class... com.mycom.app.AbstractMessage There is another class in com.mycom.model.QueryResponse QueryResponse
Hello can someone help me with this pice of code. I have app with
Using Grails 2.0.1 (upgraded from 1.3.7). In application.properties I have app.context = / and
have an app that finds your GPS location successfully, but I need to be
Have an app that has listings - think classified ads - and each listing

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.