[RESOLVED] Weird Bug on menu clicks
Hi have this strange bug or something I duno how else to put it heres the problum.
I add a menu strip to a form and a text box I add an menu item anything for example Cut I add the code
on click event TextBox1.Cut()
Now what this does are you can see is cut the text in a text box, so if I select all text click the item the text get's cut
the problum is when I click in the textbox the cursor has gone.
But now if I was to put the same code into a command button and do the same the cursor is there it makes no sence.
any ideas?
Re: Weird Bug on menu clicks
Er ... it should be the other way round. A menu item can't take focus so the cut would leave the cursor in the text box ready for whatever without any further action necessary. A button can take focus and therefore the cursor is absent after executing the command from a button. In no circumstances can the cursor fail to appear if you click inside the text box.
Re: Weird Bug on menu clicks
ok I think I found a workaround by setting focus to the main form never had to do this in VB6 or anyother lanuage I used it always left the cart were it was strange.
Code:
Private Sub mnuCut_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnuCut.Click
txtCode.Cut()
Me.Focus()
End Sub