* i removed tpnl from the layout
* added event name to pnlDialog "pnlDialog"
* changed the click event to this name
Private Sub pnlDialog_Click '<<<<<<
'dont do anything just filter all clicks
End Sub
because you load the layout to a panel you need to catch the presses on that panel
try the example below it should work