Re: Event firing twice in UserControl issue

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Just thought I chime in and say I never found any reason for the event to
fire twice.

"Kevin S Gallagher" <kevin.s.gallagher@xxxxxxxxxxx> wrote in message
news:OnhxdF8LJHA.2760@xxxxxxxxxxxxxxxxxxxxxxx
I have a user control (from Microsoft which originally was simply a control
with no panel) with a panel then a custom ListControl. I want to be able to
trap SelectedValueChanged event of the ListControl. The code shown below
works but fires off the event twice, any thoughts?

Imports System.ComponentModel
Public Class RadioButtonListPanel

Public Event selectedvaluechanged(ByVal sender As Object, ByVal e As
System.EventArgs)

Private Sub radiobuttonlist1_selectedvaluechanged(ByVal sender As Object,
ByVal e As System.EventArgs) _
Handles RadioButtonList1.SelectedValueChanged
RaiseEvent selectedvaluechanged(sender, e)
End Sub

...

Code in form hosting the control
Private Sub RadioPanel1_SelectedValueChanged(ByVal sender As Object, ByVal
e As System.EventArgs) _
Handles RadioPanel1.selectedvaluechanged

If RadioPanel1.RadioButtonList1.SelectedIndex > -1 Then
Console.WriteLine(" --> {0}",
RadioPanel1.RadioButtonList1.SelectedValue.ToString)
End If
End Sub



.



Relevant Pages

  • Passing System.EventArgs as parameters
    ... Private Sub PaintBorder(ByVal sender As Object, ... How would I call this function if I wanted to paint a border on a panel ...
    (microsoft.public.dotnet.languages.vb)
  • Problem with a Calendar control
    ... Private Sub btnEvent_Click(ByVal sender As System.Object, ... On each of these panels there are buttons that link to a calendar ... This functionality works well on the first visible panel on the page ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Moving toolbox
    ... I made a toolbox like thing by using a panel with a label docked on top. ... Private Sub Label1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseDown ...
    (microsoft.public.dotnet.languages.vb)
  • Re: reusing sub routines
    ... For example you can use the sender to change the background color of the ... panel when you are dragging over that panel, ... > how can I make one subroutine to handle events from different objects? ... > Private Sub Panel1_DragEnter(ByVal sender As Object, ...
    (microsoft.public.dotnet.languages.vb)
  • Simple? Form Design Question
    ... the visiblechanged property of a particular panel. ... private void toolStripButton1_Click(object sender, EventArgs ...
    (microsoft.public.dotnet.languages.csharp)