CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 17

Threaded View

  1. #13
    Join Date
    Mar 2003
    Posts
    145

    Re: Does a UserControl have something similar to the ‘AcceptButton’ property of a Form?

    At the beginning, when I click ‘Enter’ the 'MyAcceptButton_Click' event is fired, and I see the message box. (So far so good).
    But, then the message box is never shown again because of the ‘if sentence’.
    Code:
    private void MyAcceptButton_Click(object sender, System.EventArgs e)
    {
         if (!EnterKeyPressed)
        {
             MessageBox.Show("Works!");
             EnterKeyPressed = true;
         }
    }
    But, what does the if sentence suppose to do?

    I took your sample, and added another UserControl called DummyUserControl to it.
    This is what I want to happen:
    - When ‘AcceptButUC’ is active, clicking ‘Enter’ fires ‘MyAcceptButton_Click’ and displays the message box.
    - When ‘DummyUserControl’ is active, clicking ‘Enter’ does not fire ‘MyAcceptButton_Click’

    I’ve attached your revised solution.
    Attached Files Attached Files

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