G
GAZ
Hello all,
We have a bit of a problem. We have a form where we have to add controls
dynamically during runtime. That part is quite simple. Now, we have to add a
ButtonClick event for each of the controls. That's where it becoms tricky.
Here is the bit of code we use:
-------------------------------------------------------------------------------------
TextControl = New Asd.ControlLibrary.AsdTextControl
Me.TextControl.BackColor = System.Drawing.Color.Transparent
.....additional properties setup
If CheckStoredProcedure <> "" Then
Me.TextControl.CheckStoredProcedure = CheckStoredProcedure
Me.TextControl.ButtonBook = True
Me.TextControl.ErrrorProvider = True
Me.TextControl.CheckRequired = True
End If
AddHandler TextControl.ButtonBookClick, AddressOf TextControl_ButtonBook
Me.Controls.Add(TextControl)
--------------------------------------------------------------------------------------
Now, everything works fine and each control acts as a separate control, but
the TextControl_ButtonBook fires only for the very last created control. I
have tried adding 'sender' parameter to the procedure but the addressof
won't accept it.
Any help and/or insight is much appreciated.
Thanks in advance.
GAZ
We have a bit of a problem. We have a form where we have to add controls
dynamically during runtime. That part is quite simple. Now, we have to add a
ButtonClick event for each of the controls. That's where it becoms tricky.
Here is the bit of code we use:
-------------------------------------------------------------------------------------
TextControl = New Asd.ControlLibrary.AsdTextControl
Me.TextControl.BackColor = System.Drawing.Color.Transparent
.....additional properties setup
If CheckStoredProcedure <> "" Then
Me.TextControl.CheckStoredProcedure = CheckStoredProcedure
Me.TextControl.ButtonBook = True
Me.TextControl.ErrrorProvider = True
Me.TextControl.CheckRequired = True
End If
AddHandler TextControl.ButtonBookClick, AddressOf TextControl_ButtonBook
Me.Controls.Add(TextControl)
--------------------------------------------------------------------------------------
Now, everything works fine and each control acts as a separate control, but
the TextControl_ButtonBook fires only for the very last created control. I
have tried adding 'sender' parameter to the procedure but the addressof
won't accept it.
Any help and/or insight is much appreciated.
Thanks in advance.
GAZ