We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get the textbox of the TextBoxBarItem and fire its events in WinForms XPToolBar?

Platform: WinForms |
Control: XPToolbar

Textbox of TextBoxBarItem

You need to get hold of the internal TextBox in the TextBoxBarItem and you can access the textbox events associated with it. You can do this using the TextBoxItemBound event of the TextBoxBarItem, where you can get the internal textbox from args.TextBox. Please ensure to use the MainFrameBarManager to get this working. Please refer to the following code snippet.


this.textBoxBarItem1.TextBoxItemBound += new Syncfusion.Windows.Forms.Tools.XPMenus.TextBoxItemBoundEventHandler(textBoxBarItem1_TextBoxItemBound);
void textBoxBarItem1_TextBoxItemBound(object sender, Syncfusion.Windows.Forms.Tools.XPMenus.TextBoxItemBoundEventArgs args)
   TextBox m_textbox = args.TextBox as TextBox;
   m_textbox.Validated += new EventHandler(m_textbox_Validated);
void m_textbox_Validated(object sender, EventArgs e)
   Console.WriteLine("Event Fired");


Private Sub textBoxBarItem1_TextBoxItemBound(ByVal sender As Object, ByVal args As Syncfusion.Windows.Forms.Tools.XPMenus.TextBoxItemBoundEventArgs) Handles textBoxBarItem1.TextBoxItemBoundAddHandler args.TextBox.Validated, AddressOf TextBox_Validated
     AddHandler args.TextBox.LostFocus, AddressOf TextBox_LostFocus
End Sub
Private Sub TextBox_Validated(ByVal sender As Object, ByVal e As EventArgs)
    Console.WriteLine("Validated event fired")
End Sub

Reference link: https://help.syncfusion.com/windowsforms/xptoolbar/baritem-types#textboxbaritem

2X faster development

The ultimate WinForms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile