troubleshooting Question

Crashing happens when I set a form's public value before close the form.

Avatar of lapucca
lapucca asked on
C#
5 Comments1 Solution213 ViewsLast Modified:
Hi, I'm using vs2005, .net 2, for windows application.  Below is part of my code where I'm getting crash is when I try to:   showPgMessage = true;
In debug this jumps to the "set" part of code in the declaration "public bool showPgMessage ".  It then repeatedly highlite the "showPgMessage = value; " several times and then it exits the program.  
This form is launched as a dialog from the main form.  At the end of this form when it's closing, I need to set the showPgMessage  value so the main form can retrieve that value.  Why is it not working though?  Thanks.

  public partial class PgMessageBox : Form
    {
        public bool showPgMessage //For scrolling between forms to indicate which info. to disply
        {
            get
            {
                return showPgMessage;
            }
            set
            {
                showPgMessage = value;

            }
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            try
            {
                if (ckbShowPgMessage.Checked)
                    showPgMessage = false;
                else
                    showPgMessage = true;
                this.Close();
            }                
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message, "PowerADvantage");
            }
        }
    }
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros