Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
I forgot my password
Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, win occasional prizes given to our best members, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 24th, 2009, 12:22 PM
Friend of Wrox
Points: 994, Level: 12
Points: 994, Level: 12 Points: 994, Level: 12 Points: 994, Level: 12
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: , , United Kingdom.
Posts: 222
Thanks: 0
Thanked 4 Times in 4 Posts
Default Forms losing focus

I have created a dialog type form which i need to be the top most form and it musn't lose focus, so obviously (or not so . . ) i set the topmost property to true, but the form can still lose focus . . . any thoughts?
__________________
Apocolypse2005, I'm a programmer - of sorts.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old February 24th, 2009, 02:01 PM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,105
Thanks: 1
Thanked 57 Times in 57 Posts
Send a message via AIM to dparsons
Default

Well it depends on what you mean by 'focus'. Are you talking about a 'window' popping up in side of a browser window that contains your form that, when displayed, disables everything else on the page or are you asking how to spawn a new window and keep it as the top most window?

In the case of the former you can use a standard CSS Modal effect where the user clicks on something, a hidden div appears and overlays the entire page with a semi-transparent png thus making the form in the div the only thing that can be acted upon. You could also look into the ModalExtender control in the AJAX Toolkit.

In the case of the latter, this can be achieved with JavaScript but it is pretty annoying and I would recommed it.

hth.
-Doug
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old February 24th, 2009, 02:08 PM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,190
Thanks: 5
Thanked 58 Times in 56 Posts
Send a message via MSN to gbianchi
Default

Just to clarify, are you looking for that in web or in a form based enviroment???

(Doug, this is the vb2005, could be any case!)
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old February 25th, 2009, 06:14 AM
Friend of Wrox
Points: 994, Level: 12
Points: 994, Level: 12 Points: 994, Level: 12 Points: 994, Level: 12
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: , , United Kingdom.
Posts: 222
Thanks: 0
Thanked 4 Times in 4 Posts
Default

This is in vb2005, not web based!
I'm looking to make the form that pops up to be the top most form and can't be navigated away from until its closed.
__________________
Apocolypse2005, I'm a programmer - of sorts.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #5 (permalink)  
Old February 25th, 2009, 06:58 AM
Friend of Wrox
Points: 7,395, Level: 36
Points: 7,395, Level: 36 Points: 7,395, Level: 36 Points: 7,395, Level: 36
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Capital Federal, , Argentina.
Posts: 2,190
Thanks: 5
Thanked 58 Times in 56 Posts
Send a message via MSN to gbianchi
Default

Ok. Did you search google?? there are a lot of examples around there...

try for example ".net form always on top"

This is not a trivial mather, since you have to catch windows events to make it work (and also, you could lost focus, there is no way that you can remain focus, unless, maybe with a crazy idea, that you built a transparent form under your form that catch the entire desktop, with bars and everything).
__________________
HTH

Gonzalo


================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the
proof.
================================================== =========
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #6 (permalink)  
Old February 25th, 2009, 08:37 AM
Friend of Wrox
Points: 994, Level: 12
Points: 994, Level: 12 Points: 994, Level: 12 Points: 994, Level: 12
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: , , United Kingdom.
Posts: 222
Thanks: 0
Thanked 4 Times in 4 Posts
Default

It can be done easily, i think it is trivial.
For example, open up windows movie maker
Tools -> Options
Then try and click the main movie maker window, it doesn't let you unless you close the options dialog box.
__________________
Apocolypse2005, I'm a programmer - of sorts.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #7 (permalink)  
Old March 2nd, 2009, 04:32 AM
Friend of Wrox
Points: 994, Level: 12
Points: 994, Level: 12 Points: 994, Level: 12 Points: 994, Level: 12
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: , , United Kingdom.
Posts: 222
Thanks: 0
Thanked 4 Times in 4 Posts
Default The proper answer to this thread

Effectivily what i was trying to do was to make a dialog out of a form, so when i call the form to show instead of using form.show which gives standard results ii should of used form.showdialog(me) which gives the form all the properties of a dialog form such as; waiting till the user inputs data and the form is closed before carrying out the next line of code - which is not true when .show method is used because once it's shown the parent form goes to next line of code, and focus on that form cannot be lost to the parent form so achieving always on top.

So the code is:

Code:
Dim dialogForm As New Form1
dialogForm.showdialog(me)
__________________
Apocolypse2005, I'm a programmer - of sorts.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #8 (permalink)  
Old August 10th, 2009, 05:36 AM
Authorized User
 
Join Date: Aug 2009
Posts: 18
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Add some code on that forms.
Private Sub Form1_load(...)
Form1.Focus()
End Sub
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #9 (permalink)  
Old August 20th, 2009, 08:36 AM
Friend of Wrox
Points: 994, Level: 12
Points: 994, Level: 12 Points: 994, Level: 12 Points: 994, Level: 12
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2005
Location: , , United Kingdom.
Posts: 222
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Quote:
Originally Posted by Lupus81 View Post
Add some code on that forms.
Private Sub Form1_load(...)
Form1.Focus()
End Sub
No point the question has been answered, that wouldnt work though because it wouldn't stop the form that called that event carrying on processing the rest of the subs code, the thing with showdialog is that it haults the caller until an answer has been given or the dialog has been closed!
__________________
Apocolypse2005, I'm a programmer - of sorts.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
DAP losing connection.... kalebson Access 4 July 10th, 2006 09:05 AM
Multiple Forms and the Return Key Focus rit01 ASP.NET 2.0 Basics 4 June 20th, 2006 01:44 PM
Losing my MIND!!! johne ASP.NET 1.1 3 July 8th, 2005 08:26 PM
Losing variables bluemat XSLT 2 October 16th, 2004 01:59 AM
Switch Focus between 2 Forms lxu Access 1 March 11th, 2004 08:49 AM



All times are GMT -4. The time now is 08:06 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
© 2011 John Wiley & Sons, Inc.