\r\n\r\n
Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > Interface and Graphics > Problem 'Setting Focus' to WebBrowser


\r\n \r\n
 
 
Thread Tools Display Modes

\r\n\r\n\r\n
Hey everyone,
\r\n
\r\nMy problem would appear to be a simple one but it is one I cannot seem to remedy.
\r\nI have a FORM which contains 2 COMMAND BUTTONS and a WEB BROWSER, in which a basic computer game is displayed.
\r\nIn order to start the process which, controls the computer game, the user must press the start button, however this then Sets the focus on the Start Button which, means the focus is taken off the Web Browser and therefore the desired action does not take place in the game.
\r\nI’ve tried setting the focus to the Web Browser as shown in the code segment below but this doesn\'t seem to work.
\r\nAny help or advice would be much appreciated.
\r\nThanking you in advance.
\r\n
\r\n
\r\n
Code:
\r\n
Private Sub START_Click()\r\n\r\ndirpath = "C:\\LOCATION\\ioFiles\\"\r\n\r\nSlowerFaster.Caption = ""\r\nAmpFeedback.Caption = ""\r\n\r\n\r\n stopStart.FontSize = 18\r\n stopStart.FontBold = True\r\n \r\nglo.TaskID = Shell("C:\\Blank\\getsamples.exe", vbMinimizedNoFocus) \'Start "getsamples.exe"\r\n\r\nSleep 100\r\nWebBrowser1.SetFocus\r\nSleep 100\r\n\r\nstopStart.Caption = "START"\r\n\r\nDoEvents
\r\n
\r\n \r\n\r\n
\r\n \r\n\r\n \r\n \r\n\r\n \r\n \r\n
\r\n __________________
\r\n Emmetts\r\n
\r\n \r\n \r\n\r\n \r\n\r\n \r\n\r\n
\r\n \r\n \r\n \r\n \r\n Reply With Quote\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n \r\n\r\n
\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n\r\n\r\n\r\n\r\n'; pd[1150707] = '\r\n\r\n \r\n\r\n
\r\n
\r\n
\r\n\r\n
\r\n \r\n\r\n\r\n\r\n\r\n\r\n \r\n\r\n\r\n\r\n \r\n
\r\n
\r\n  \r\n #2  \r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n
\r\n \r\n Old\r\n \r\n 05-27-2006, 08:39 AM\r\n \r\n \r\n \r\n
\r\n
\r\n \r\n \r\n \r\n \r\n \r\n
\r\n\r\n
\r\n \r\n Racemaniac\r\n Racemaniac is offline\r\n\r\n\r\n
Prev Previous Post   Next Post Next
  #1  
Old 05-27-2006, 08:04 AM
Emmetts2 Emmetts2 is offline
Newcomer
 
Join Date: Feb 2006
Location: Tipperary, Ireland
Posts: 8
Default Problem 'Setting Focus' to WebBrowser


Hey everyone,

My problem would appear to be a simple one but it is one I cannot seem to remedy.
I have a FORM which contains 2 COMMAND BUTTONS and a WEB BROWSER, in which a basic computer game is displayed.
In order to start the process which, controls the computer game, the user must press the start button, however this then Sets the focus on the Start Button which, means the focus is taken off the Web Browser and therefore the desired action does not take place in the game.
I’ve tried setting the focus to the Web Browser as shown in the code segment below but this doesn't seem to work.
Any help or advice would be much appreciated.
Thanking you in advance.

Code:
Private Sub START_Click() dirpath = "C:\LOCATION\ioFiles\" SlowerFaster.Caption = "" AmpFeedback.Caption = "" stopStart.FontSize = 18 stopStart.FontBold = True glo.TaskID = Shell("C:\Blank\getsamples.exe", vbMinimizedNoFocus) 'Start "getsamples.exe" Sleep 100 WebBrowser1.SetFocus Sleep 100 stopStart.Caption = "START" DoEvents
__________________
Emmetts
Reply With Quote
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->