[RESOLVED] Toolstripbutton not validating textbox.
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: [RESOLVED] Toolstripbutton not validating textbox.

  1. #1
    Join Date
    Sep 2008
    Posts
    79

    [RESOLVED] Toolstripbutton not validating textbox.

    I have a textbox, a standard button and a toolstrip containing a couple of buttons.
    In the validating event of the textbox i coded to check whether it is blank.
    If yes then it shows a message 'Enter Value'. When the standard button is clicked while
    the textbox is empty, it's validating properly and showing the message but when the
    toolstripbutton is clicked it's not not validating the textbox and no message is being
    shown. It seems that I gotto write the validation code explicitly in the
    toolstripbutton_click event which is too troublesome when there are multiple textboxes
    and toolstripbuttons on a single form. What I want to know is whether the
    textbox_validating can be fired while the toolstripbutton is clicked?
    Handling toolstrips is really a headache.
    Please help. I'm badly in need of it. Regards.

  2. #2
    Join Date
    Sep 2008
    Posts
    79

    Thumbs up Re: Toolstripbutton not validating textbox.

    While clicking any toolstrip button just validate the entire for before calling any method. This way it'll fire the textbox validating event.

    Code:
    If (this.Validate)
    {
      // Call your method.
    }

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center