|
-
Aug 4th, 2006, 10:48 AM
#1
Thread Starter
Lively Member
checking a form has focus
Hi.
I have a form which calls another form on the click of a button and is then returned to when the called form is closed. On return to the original form I want to call some code that refreshes the original form but cannot find a way to only call that code once the original form is being returned to. At the moment it is calling that code as soon as the second form has been opened. Any help would be greatly appreciated!
Code shown below:
Private Sub buStaffDets_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buStaffDets.Click
gvar_IDToPass = coPropID.Text
gvar_EditOrNewPerson = "Edit"
gvar_theChkBox = "radStaff"
Dim frmPersonDetails As New frmPersonDetails
frmPersonDetails.Show()
populateFields()
End Sub
-
Aug 4th, 2006, 01:13 PM
#2
Re: checking a form has focus
You can use the form closed method of the second form:
VB Code:
Private Sub SecondForm_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed
Dim frmPersonDetails As New frmPersonDetails
frmPersonDetails.Show()
populateFields()
End Sub
-
Aug 4th, 2006, 01:45 PM
#3
Fanatic Member
Re: checking a form has focus
Or you could try:
VB Code:
Private Sub buStaffDets_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles buStaffDets.Click
gvar_IDToPass = coPropID.Text
gvar_EditOrNewPerson = "Edit"
gvar_theChkBox = "radStaff"
Dim frmPersonDetails As New frmPersonDetails
frmPersonDetails.ShowDialog()
populateFields()
End Sub
This will open the new form as modal and the code after the frmPersonDetails.ShowDialog() line will not be run until the form is closed.
-
Aug 7th, 2006, 03:50 AM
#4
Thread Starter
Lively Member
Re: checking a form has focus
Thanks for the advice both,
I used the showdialog method which worked fine.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|