• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 163
  • Last Modified:

show form, but no field has focus until manually click

I have a simple form, that shows a second "data entry form".  

From the main form, I show the second form using:
            Dim frmEntry As New Form1
            Me.AddOwnedForm(frmEntry)
            frmEntry.Show()

When the data entry form is shown, the first field should have the focus.  I would think that would be the default behaviour.  However, no field has focus.  It looks like the form header bar has the foucs, until I click on some field in the form.  This app is for a high volume wharehouse, and it matters to save every click and key stroke.

I checked the tab order, and made sure that my first field, was the first tab.  Also, I have even put an "Me.field1.focus()"  in the form load event, to try to force the focus.  

I am new to this, so if I'm missing something obvious, I would be happy to hear it.
Any help greatly appreciated.
0
down0041
Asked:
down0041
  • 3
  • 3
1 Solution
 
down0041Author Commented:
Correction.
It appears that the main form header has the focus.  (The second form is displayed on top of the main form.)
0
 
SanclerCommented:
Add
        frmEntry.Focus()
after
           frmEntry.Show()

Roger
0
 
down0041Author Commented:
I have actually tried that.  In looking closer at what I'm doing, I'm calling the showForm from the "form loaded event" of the first form.  I think that is creating the problem.  If I put my code in a button on the main form, then everything works as you would expect.  I am re-structering my forms, to avoid having to deal with this.
Thank you for your input.
td
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
SanclerCommented:
I think if you move it to the form Activated event of the main form it should work.  And it gets rid of the extra key stroke that a button on the main form involves.  If that would be easier than a restructure.

Roger
0
 
SanclerCommented:
Though you'd also need a Static Boolean so that a new subForm would not load every time the mainForm was re-activated.

Roger
0
 
down0041Author Commented:
Thank you!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now