do code like below,
Dim Container As Panel = DirectCast(sender.parent,Panel )
if block= "Motor" then
Dim tag As TextBox = DirectCast(Container.Controls.find(MotorTag(index),true).GetValue(0), TextBox)
else if block= "valve" then
Dim tag As TextBox = DirectCast(Container.Controls.find(ValveTag(index),true).GetValue(0), TextBox)
end if
Happy Coding!
:)