R
Randy
I have a form on which various controls are added dynamically
depending on actions of the user. One of these actions allows the
user to click a delete button that will remove various other
controls. I was trying to accomplish this Click procedure by
capturing the active contold using activecontrol.name and then
removing it, but as soon as I click on the Delete button, the active
controls changes to the delete button, not the control that I want to
remove. Here is the code:
Private Sub btnDelCtl_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnDelCtl.Click
Dim ctlThisCtl As String = ActiveControl.Name
MessageBox.Show(ctlThisCtl) 'to confirm deletion of the
correct control
End Sub
When I run this, the value of ctlThisCtl is "btnDelCtl", which is not
what I want to delete. Anybody have a suggestion as to how I can
capture the control that was active immediately prior to clicking the
btnDelCtl button?
Thanks,
Randy
depending on actions of the user. One of these actions allows the
user to click a delete button that will remove various other
controls. I was trying to accomplish this Click procedure by
capturing the active contold using activecontrol.name and then
removing it, but as soon as I click on the Delete button, the active
controls changes to the delete button, not the control that I want to
remove. Here is the code:
Private Sub btnDelCtl_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnDelCtl.Click
Dim ctlThisCtl As String = ActiveControl.Name
MessageBox.Show(ctlThisCtl) 'to confirm deletion of the
correct control
End Sub
When I run this, the value of ctlThisCtl is "btnDelCtl", which is not
what I want to delete. Anybody have a suggestion as to how I can
capture the control that was active immediately prior to clicking the
btnDelCtl button?
Thanks,
Randy