|
-
Jul 17th, 2010, 03:07 AM
#1
Thread Starter
Addicted Member
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.
-
Jul 17th, 2010, 03:43 AM
#2
Re: help need to set focus on form1
-
Jul 17th, 2010, 07:44 AM
#3
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
-
Jul 17th, 2010, 03:57 PM
#4
Fanatic Member
Re: help need to set focus on form1
Just do after it loads Form2, say
Form1.Show.
That should work.
-
Jul 18th, 2010, 09:13 AM
#5
Thread Starter
Addicted Member
Re: help need to set focus on form1
 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.
-
Jul 18th, 2010, 01:55 PM
#6
Fanatic Member
Re: help need to set focus on form1
thats werid..... is it because you unloaded form 1?
-
Jul 18th, 2010, 05:34 PM
#7
Hyperactive Member
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
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
|