Remove button from textbox

2 posts, 0 answers
  1. Terry
    Terry avatar
    39 posts
    Member since:
    Sep 2007

    Posted 20 Aug 2012 Link to this post


    Following on from a piece of code I found in the forums which shows how to add a button to a text box. I can't seem to figure out how to remove it! - Can anybody help?

    Public Sub AddButton()
            Dim buttonElement As New RadButtonElement("...")
            AddHandler buttonElement.Click, AddressOf buttonElement_Click
            Dim textBoxItem As RadTextBoxItem = Me.RadTextBox1.TextBoxElement.TextBoxItem
            textBoxItem.Alignment = ContentAlignment.MiddleLeft
            Dim dockLayoutPanel As New DockLayoutPanel()
            dockLayoutPanel.SetDock(textBoxItem, Telerik.WinControls.Layouts.Dock.Left)
            dockLayoutPanel.SetDock(buttonElement, Telerik.WinControls.Layouts.Dock.Right)
        End Sub
  2. Stefan
    Stefan avatar
    2891 posts

    Posted 23 Aug 2012 Link to this post

    Hello Terry,

    Thank you for writing.

    Here are a couple of methods demonstrating how to completely remove the button, how to hide it and how to show it, considering that you added it with the method mentioned:
         Sub RemoveButton()
       End Sub
       Sub HideButton()
           Me.RadTextBox1.TextBoxElement.Children(2).Children(0).Visibility = Telerik.WinControls.ElementVisibility.Collapsed
       End Sub
       Sub ShowHiddenButton()
           Me.RadTextBox1.TextBoxElement.Children(2).Children(0).Visibility = Telerik.WinControls.ElementVisibility.Visible
       End Sub

    I hope that you find this information useful.
    the Telerik team
    RadControls for WinForms Q2'12 release is now live! Check out what's new or download a free trial >>
  3. DevCraft R3 2016 release webinar banner
Back to Top