We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,503 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Setting focus on new form

Hi everyone,

I have 3 forms: main, AdvancedSearchMenu, and FacilitySearch.
When the user clicks the AdvancedSearchMenu button on the main form, a new form appears in the style of a popup.
This form contains a few different controls, including a button for FacilitySearch.

I want the form to change from AdvancedSearchMenu to FacilitySearch when the user clicks the FacilitySearch button, but I don't know how to set focus to this FacilitySearch form when the switch happens.

Here is my code:

Public Class advSearchMenu

Private Sub FacilityButton_Click(sender As System.Object, e As System.EventArgs) Handles FacilityButton.Click
        Me.Visible = False
        FacilityAdvSearch.Show()
End Sub

End Class

After the switch (from AdvancedSearchMenu to FacilitySearch) happens, the entire application loses focus, and I have to hit Esc to set focus back to the application. And when this happens, the focus is set on the main form, not the FacilitySearch.

Any help would be appreciated.
Thanks in advance.

2
Contributors
1
Reply
4 Hours
Discussion Span
7 Months Ago
Last Updated
2
Views
echo12
Newbie Poster
2 posts since Oct 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

try using FacilityAdvSearch.ShowDialog() in place of FacilityAdvSearch.Show()

AnkitGuru
Light Poster
40 posts since Jul 2011
Reputation Points: 8
Solved Threads: 5
Skill Endorsements: 0

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page rendered in 0.0578 seconds using 2.65MB