help need to set focus on form1
hi guys,
I have two forms in a vb6 project. Form1 has a timer, which loads form2 after some interval, and after loading form2 autometically closed after some second (and repeated till program running). My problem is that when form2 loads, it looses the focus from form1. I want to load form2 without disturbing or loosing focus from form1. Pleas help.
Re: help need to set focus on form1
Re: help need to set focus on form1
Edgemeal's posted URL works fine. Here's a non-API approach:
Code:
Option Explicit
Private Sub Form_Activate()
SetFocus 'will error if called in Form_Load
End Sub
Private Sub Form_Load()
Form2.Move Left + Width, Top
Form2.Show
End Sub
Private Sub Form_Unload(Cancel As Integer)
Unload Form2
End Sub
Re: help need to set focus on form1
Just do after it loads Form2, say
Form1.Show.
That should work.
Re: help need to set focus on form1
Quote:
Originally Posted by
Gamemaster1494
Just do after it loads Form2, say
Form1.Show.
That should work.
That works, but it loads form1 in new window each time.
Re: help need to set focus on form1
thats werid..... is it because you unloaded form 1?
Re: help need to set focus on form1
This works:
In your sub that triggers form2 to load put;
form2.show
me.setfocus
I just tried it with a command button and did exactly that, form2 loaded behind form1