0

I have made a button (btnImageRemove) get shown and hidden based on if the mouse is inside the component, but when i then click that button the event doesnt fire.

Private Sub btnImageRemove_Click(sender As Object, e As EventArgs) Handles btnImageRemove.Click
    lblAvatar.Image = Nothing
    lblAvatar.Tag = Nothing
End Sub

Private Sub lblAvatar_MouseLeave(sender As Object, e As EventArgs) Handles lblAvatar.MouseLeave
    btnImageRemove.Visible = False
End Sub

Private Sub lblAvatar_MouseEnter(sender As Object, e As EventArgs) Handles lblAvatar.MouseEnter
    btnImageRemove.Visible = True
    btnImageRemove.BringToFront()
End Sub

Private Sub btnImageRemove_MouseClick(sender As Object, e As MouseEventArgs) Handles btnImageRemove.MouseClick
    lblAvatar.Image = Nothing
    lblAvatar.Tag = Nothing
End Sub

I have tried all the click and mouseclick events on the button, and all components that take its area, but i cannot get an event to fire for that button

Narrowed down cause a little more: I have narrowed down to if i add anything to show / hide the button at runtime, during another event, the button doens't fire a click event, nor turn orange (default dotnetbar button action)

f1wade
  • 2,877
  • 6
  • 27
  • 43
  • 1
    your `btnImageRemove` is `Visible` only if your mouse is over `lblAvatar`, are you sure your `btnImageRemove` is visible when you click on "it"? – King King Aug 20 '13 at 15:42
  • Bring your `btnImageRemove` to the side , or completely out of the scope of the `lblavatar.image` control , see if its being pulled to the `front` – Don Thomas Boyle Aug 20 '13 at 15:43
  • @KingKing good idea maybe he should use `mouseover` event? instead of `enter` so it still is recognized as "within bounds"? – Don Thomas Boyle Aug 20 '13 at 15:45
  • There is no mouseOver. The button is visible, as I can see it, otherwise i wouldn't be sure that i was clicking it. i have moved to the side, but the event only fires when the mouse is over the button but not the image. but when it over both the image and the button nothing fires, not the button event nor the image click event, nor mouseclick etc etc – f1wade Aug 20 '13 at 15:52
  • I found out that the button is getting Hidden when i move the mouse over it, but because the mouse is over it it appears as thought its still there. SO btnImageRemove IS NOT VISIBLE WHEN I CLICK IT. for now Ive just moved the btn away from any conflicting regions. – f1wade Aug 30 '13 at 09:33

0 Answers0