CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 9 of 9
  1. #1
    Join Date
    Jun 2011
    Posts
    33

    WFA MessageBox.show Issues

    I've been puzzling over this for hours. Whenever I recompile the code, it compiles succesfully and I get my main form but when I click on the button, no message box appears. What am I doing wrong? My main code, my Form2.cs code is this:

    Code:
    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 WindowsFormsApplication1
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                MessageBox.Show("Message", "Message");
            }
        }
    }
    Last edited by Krunchyman; June 8th, 2011 at 10:24 PM.

  2. #2
    Join Date
    Jun 2011
    Posts
    33

    Re: WFA MessageBox.show Issues

    Pardon the line spacing error in the OP. I didn't see any XML features or anything.

  3. #3
    Join Date
    Jun 2008
    Posts
    2,477

    Re: WFA MessageBox.show Issues

    Use [ code] tags.

    Sounds like your event handler isn't actually hooked up. You probably created it through the designer, but did you do something that would cause it to be 'broken', i.e., delete the original button and place a new one there? Do you see the even subscription in your designer.cs file?

  4. #4
    Join Date
    Jun 2011
    Posts
    33

    Re: WFA MessageBox.show Issues

    Quote Originally Posted by BigEd781 View Post
    Use [ code] tags.

    Sounds like your event handler isn't actually hooked up. You probably created it through the designer, but did you do something that would cause it to be 'broken', i.e., delete the original button and place a new one there? Do you see the even subscription in your designer.cs file?
    I don't see any even subscription in the designer.cs file.

  5. #5
    Join Date
    Jun 2008
    Posts
    2,477

    Re: WFA MessageBox.show Issues

    Well then that would be your problem. Add it back in again via the designer or inside of your form's constructor.

  6. #6
    Join Date
    Jun 2011
    Posts
    33

    Re: WFA MessageBox.show Issues

    Quote Originally Posted by BigEd781 View Post
    Well then that would be your problem. Add it back in again via the designer or inside of your form's constructor.
    Can you show me how to do that?

  7. #7
    Join Date
    Jun 2008
    Posts
    2,477

    Re: WFA MessageBox.show Issues


  8. #8
    Join Date
    Jun 2011
    Posts
    33

    Re: WFA MessageBox.show Issues

    Quote Originally Posted by BigEd781 View Post
    I did that but it's still not working.

  9. #9
    Join Date
    Jun 2011
    Posts
    33

    Re: WFA MessageBox.show Issues

    Bump.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured