Hi Sheryl,
You can use the AddHandler statement to add any of a control's available
events. When you do that, you need to provide the subroutine that runs when
the event fires. The subroutine has to accept the same parameters as the
event passes. Here's some code to show the idea:
Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Dim lnkbtn As New LinkButton
lnkbtn.Text = "My Link"
lnkbtn.CommandArgument = "MyArg"
AddHandler lnkbtn.Click, AddressOf ClickHandler
PlaceHolder1.Controls.Add(lnkbtn)
End Sub
Sub ClickHandler _
(ByVal s As Object, ByVal e As EventArgs)
Response.Write("Clicked")
End Sub
Let us know if this helps?
Ken
Microsoft MVP [ASP.NET]
Toronto