Custom Item Button Events in List View

5 posts, 0 answers
  1. Denis Cilliers
    Denis Cilliers avatar
    62 posts
    Member since:
    Jan 2004

    Posted 19 Nov 2012 Link to this post

    The documentation does not show how to capture the events from the custom Item buttons.

    http://www.telerik.com/help/winforms/listview-custom-items.html

    Please can we have an example in vb.net 

    thanks
  2. Jason
    Jason avatar
    14 posts
    Member since:
    Oct 2011

    Posted 20 Nov 2012 Link to this post

    Just provide an override for the click event in the MyCustomVisualItem class.

    Public Overrides Sub buttonElement1_Click(sender As Object, e As EventArgs)
     
        '' do something
     
    End Sub
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Denis Cilliers
    Denis Cilliers avatar
    62 posts
    Member since:
    Jan 2004

    Posted 21 Nov 2012 Link to this post

    Nope the event does not fire

    This is how I currently have the code 

    Private WithEvents buttonElement1 As RadButtonElement
    Private WithEvents checkboxComplete As RadCheckBoxElement
     
     Public Sub ButtonElement1_Click(sender As Object, e As EventArgs) Handles buttonElement1.Click
     
            MessageBox.Show("ButtonElement1_Click")
     
    End Sub
     
    Public Sub CheckboxComplete1_StateChanged(sender As Object, e As EventArgs) Handles checkboxComplete.ToggleStateChanged
     
          MessageBox.Show("CheckboxComplete1_StateChanged")
    End Sub

    But no success so far
  5. Jason
    Jason avatar
    14 posts
    Member since:
    Oct 2011

    Posted 21 Nov 2012 Link to this post

    If you can translate some C# to VB.NET just download the code in this post - it shows how to do it.

    http://www.telerik.com/community/forums/winforms/listview/custom-button-in-4th-column.aspx#2306251
  6. Stefan
    Admin
    Stefan avatar
    2890 posts

    Posted 22 Nov 2012 Link to this post

    Hello guys,

    Thank you for writing.

    In the CreateChildElements method of the custom item you can subscribe to the button's Click event:
    AddHandler buttonElement1.Click, AddressOf buttonElement1_Click;
    and then handle the click as you need:
    Private Sub buttonElement1_Click(sender As Object, e As EventArgs)
        'do smth
    End Sub

    I hope this helps. Let us know if you have any additional questions. 

    Regards,
    Stefan
    the Telerik team
    Q3’12 of RadControls for WinForms is available for download (see what's new). Get it today.
Back to Top
UI for WinForms is Visual Studio 2017 Ready