Problem with Focus on activated

G

Guest

Hello,

I'm trying to set the focus on a form to the first control on the form when
the form is activated. I'm basically coming back to the form from another
form and want the form cleared and focus returned to the start.

Here's my activated event.
Private Sub frmTicketingItems_Activated(ByVal sender As Object, ByVal e
As System.EventArgs) Handles MyBase.Activated
updateStatus()
pnl.Controls(1).Focus()

End Sub

There's a label in the 0 index control which is why I am setting focus on
index 1.

The code runs properly, but the focus stays in the control I last had it in
when I left the screen at first, or focus disappears completely.

Any help is appreciated.

Thank
Robert Brown
 
G

Guest

Yes I tried when the form gets focus switch the focus to the first control,
but it doesn't work either.

It's very weird because if you step through the code, you can watch the
focus switch to the first control in the activated event, but then at the end
of the activated event it switches off the first control back to the previous
control again without running through any of my code.

Robert Brown
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top