This is a migrated thread and some comments may be shown as answers.

Custom Item Button Events in List View

4 Answers 369 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Denis Cilliers
Top achievements
Rank 1
Denis Cilliers asked on 19 Nov 2012, 01:21 PM
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

4 Answers, 1 is accepted

Sort by
0
Jason
Top achievements
Rank 1
answered on 20 Nov 2012, 09:24 PM
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
0
Denis Cilliers
Top achievements
Rank 1
answered on 21 Nov 2012, 09:25 AM
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
0
Jason
Top achievements
Rank 1
answered on 21 Nov 2012, 05:44 PM
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
0
Stefan
Telerik team
answered on 22 Nov 2012, 08:55 AM
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.
Tags
ListView
Asked by
Denis Cilliers
Top achievements
Rank 1
Answers by
Jason
Top achievements
Rank 1
Denis Cilliers
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or