Jump to content
Xtreme .Net Talk

Recommended Posts

Posted (edited)

hi folks

 

the following code creates a compositecontrol and adds a button to the control. the button gets a handler for the click-event.

 

this works all fine, except: the sub button_click is called twice.

 

why???

 

best regards

 

george

 

Private WithEvents btnSearch As New WebControls.Button
Protected Overrides Sub CreateChildControls()
 AddHandler btnSearch.Click, AddressOf btnSearch_Click
 Me.Controls.Add(btnSearch)
 MyBase.CreateChildControls()
End Sub
Public Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click
 ' this code is executed twice...
End Sub

Edited by PlausiblyDamp

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...