|
-
Feb 9th, 2010, 08:26 AM
#1
Thread Starter
Addicted Member
2 Forms
Hello, I have 2 forms inwhich they are both in the same position and always will be! I will not explain why but please can I just have a helping answer 
I want my form2 to always stay on-top of Form1 without having to have topmost on!
Thanks, Help really Appreciated!
-
Feb 9th, 2010, 08:30 AM
#2
Re: 2 Forms
Here's the solution... of sorts... without TopMost
vb.net Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim tmr As New Timer tmr.Interval = 20 AddHandler tmr.Tick, AddressOf tmr_Tick End Sub Private Sub tmr_Tick(ByVal sender As Object, ByVal e As EventArgs) Me.BringToFront() End Sub
-
Feb 9th, 2010, 08:43 AM
#3
Thread Starter
Addicted Member
Re: 2 Forms
Don't work.. Still Form1 is above Form2
Notes:
Form1.Opacity = 50
-
Feb 9th, 2010, 08:51 AM
#4
Re: 2 Forms
Why try to re invent the wheel ¿
The TopMost property is there for a reason. BringToFront is there for a reason. dcrew, you say you will not explain why you want to reinvent the wheel, unfortunately, you'll have to explain what you want ....
VB.NET MVP 2008 - Present
-
Feb 9th, 2010, 08:53 AM
#5
Re: 2 Forms
Oh, if you need the Form2 being on top Form1 then place this code in Form 2.
-
Feb 9th, 2010, 08:56 AM
#6
Thread Starter
Addicted Member
Re: 2 Forms
No, There is no existing reason why i should. I think my only question was specifically 'I have 2 Forms, I want Form2 to be always ontop of Form1 without having to TopMost everything else' It's such a simple question and of matter there is'nt to as why you need to know why I want to do this. All I indeed need to know is the question inserted into ' tags above.
-
Feb 9th, 2010, 09:02 AM
#7
Re: 2 Forms
If you want Form 2 to be ontop of Form1 then why do you set opacity of Form1 to 50%?
-
Feb 9th, 2010, 09:03 AM
#8
Re: 2 Forms
OK, no need to be sarcastic, and attacking. I was saying that you are trying to reinvent the wheel for which there is no need. The TopMost property, as i said, has a specific function, which does what you want. If you don't want that, fine. If you want to reinvent the wheel, fine. If you don't want my advice, fine.
VB.NET MVP 2008 - Present
-
Feb 9th, 2010, 09:04 AM
#9
Thread Starter
Addicted Member
Re: 2 Forms
As i have completed it now and made a timer called BtF
Input Code
Thanks, Cicatrix, HanneSThEGreaT
-
Feb 9th, 2010, 02:57 PM
#10
Re: 2 Forms
When you show Form2 from Form1, you simply pass in form1 instance as its owner:
Code:
'this code is in Form1
Dim frm2 As New Form2()
frm2.Show(Me)
Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
- Abraham Lincoln -
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
|