Can't Give Focus To The Form
Hi, someone gave me the very helpful code below for assigning arrow keys to functions in a program. It works great in isolation, but when I loaded it into my program with buttons on the form the buttons always take focus instead of the form itself. Therefore pressing the arrow buttons simply scrolls through the button focuses instead of triggering the Msgboxes that are indicated in the code. I tried adding KeyAscii = 0 before the select case but no avail. Form's KeyPreview property is set to TRUE. This is such a simple matter in PERL (just a single "bind" command), but it seems to be a nightmare in VB. Thanks for your help. private Sub Form_KeyUp(KeyCode as Integer, Shift as Integer) Select Case KeyCode Case vbKeyLeft Msgbox "You pressed left" Case vbKeyRight Msgbox "You pressed right" Case vbKeyUp Msgbox "You pressed up" Case vbKeyDown Msgbox "You pressed down" Case else Msgbox "You pressed another key" End SelectEnd Sub
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
How To Give Focus To Activex Component On Form Focus?
Using the Reflections ActiveX component (Reflections is a popular Terminal Editor for connecting with old Alpha/VMS servers), I have a Form with this internal terminal editor ActiveX that obviously needs to have focus to type in.
I've tried setting Form_GotFocus and Form_Click to give focus to the activex component but to no avail. The only thing that works is if I set Form_Repaint to give focus, then it works fine. But repaint causes the window to constantly try to bring itself in front of other Microsoft apps like Word and Outlook and other VB apps when I drag them in front of it. And it keeps flashing in the task bar when I move something non-MS in front of it.
Is there a better way to keep focus on the activex terminal session when the form gets focus without using repaint?
Can't Give Textbox On Another Form Focus
I get an "Invalid procedure call or argument" error on line
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
msh.Rows = 0
If gCalledForm = "frmForm1" Then
ElseIf gCalledForm = "frmForm2" Then
gCalledForm = vbNullString
How can I give the Textbox focus on these forms when closing another form?
How To Load A New Form - But Not Give It Focus?
If I wanted to show form2, like a regular form but not give it focus.. how can I do that?
is not an option because i have like 10 windows and i dont want form1 getting focus when form3 has current focus (for example)
How To Show A New Form, But Not Give It Focus?
Dim frm as Form
that shows the form, but gives it focus
Dim frm as Form
that does not show the form, (thus does not give it focus)
How can you show a form and not give it focus?
I Need To Highlight Some Text, But Give Focus To Another Form.
Hi, I need to highlight some text in a textbox but have focus on a different form. If I just select the text in the textbox and then say Form2.SetFocus, the selection is no longer visible. Does anybody now how to get around that?
Thank you in advance
Give Another App. Focus
Another silly but frustrating thing I can't seem to find a sulotion for. 8)
My VB app performs a few necessary system changes before a second app is initialised. That all works perfectly and the second app is called successfully via the folowing code:
Private Sub InvokeApp()
My problem is the the second app initialises minimised to the task bar when called like this.
Is there any way to pass focus to another app from vb, not just another form?
Give Powerpoint The Focus
I have made a simple VB6 app that has command buttons to control a projector via mscomm.
I would like to know how to return the focus back to powerpoint's active presentation automatically, as if you have press the PowerPoint show button on the taskbar.
Suppose all in need to know is "how to contol the taskbar" to automatically press the correct taskbar button to return the focus back to PPt.
Resolved - Give Focus To A Tab
I have an SS tab strip on a form. How do I give focus to the 3rd tab when an event occurs, ie a command button is pressed?
Also can I disable a single tab as the enabled property applies to all the tabs?
Give Back Focus
I have a form running as always on top (set that way using api). I show and hide this form using the standard, me.show or me.hide. Whenever I show the form it takes the focus from whatever app is being used. I have tried everything from standard vb calls to api calls trying to give the focus back to the last used app. I even resorted to using SendKeys with Alt Tab key combo, but that turned out to be unreliable (as it should be).
Is there any good way to get focus back to the last used application?
Give A Label The Focus
I need to make some labels work like a combination of option buttons and check boxes (don't ask).
I've got it working, except for the fact that the labels can't receive focus.
I really don't need them to have the focus, BUT, I would like to focus to leave the previous control when I click on the label.
Ideas on the best way to do this? Should I put the labels in a picturebox or something, and give the picturebox the focus if the user clicks a label?
Give Focus To MDIChild From Different App.
What I'm trying to do isss. Give an MDIChild window keyboard focus by hwnd.
This MDIChild isn't part of my application.
Therefore SetFocus api won't work.
ie:Code:Declare Function SetFocus Lib "user32" Alias "SetFocus" (ByVal hwnd As Long) As LongCode:The SetFocus function sets the keyboard focus to the specified window. The window must be associated with the calling thread’s message queue.Any idea's ? Tried using SendMessage to send a WM_SETFOCUS.. That was a no no..
Same for api SetActiveWindow. Window must be associated with the calling thread's message queue.
Tried sending a WM_CHILDACTIVATE no go...
Can I use WM_ACTIVATEAPP ? Don't have vb here to try, but can't stop thinking.
So I'll try it when I get home. The exact situation is hard to explain sorry.
Any input is greatly appreciated....
Give App Maximized Focus
I am using the following code (that was posted yesterday) to open a specific access report. The part I'm hung up on is getting the report in Access to have the maximized focus. Can the Shell Function be used for this? I tried using it to launch Access and have it maximized, but not to open a specific report.
Any help is greatly appreciated.
public Sub RunReport(strDatabase as string, strReport as string)
Dim dbAccess as Object
on error GoTo ErrorHandler
set dbAccess = new Access.Application
dbAccess.DoCmd.OpenReport strReport, acPreview
set dbAccess = nothing
If Err.Number = 2501 then resume next
How Can I Give InputBoxes Focus???
After making an exe file, ImputBoxes in my app do not have focus. They are shown and the curser is flashing in the text InputBox and I have to click on it to give it focus.
After lost focus on a combo, if a condition is not true I have the code, "Call Command1_Click"
Private Sub Command1_Click()
NEW_Value = InputBox("Please enter the New Value.")
This works ok in IDE, the inputBox has focus but not from the exe.
How can I give the inputBox focus when called?
Any help appreciated.
Give A New Word.Application The Focus
How do I give my new Word.Application the focus. This code only runs word in the background:
Dim wrd As Word.Application
Set wrd = New Word.Application
How Do I Give MSFlexGrid Focus Programmatically?
I have a form with a tab control, a separate MSFlexGrid control sits on each tab.
I have coded the FlexGrids to understand the Right Mouse button, so that the user can navigate by both buttons and use the Right Mouse to "pop up" other forms based on the values in the grid. Left Mouse is basically used for data entry...
My problem is this: Upon loading the form or tabbing between the different MSFlexGrids; only the left mouse button will give the MSFlexGrid its initial focus. Right click will not respond at all until a Left-click has occurred. So, the user has to Left-Click then Right-Click the first time that they need to use the Right Mouse button.
I'd like the grid to respond to the right click immediately upon opening the form or selecting the tab. Right now I've faked it out by Hooking the Mouse event and sending a left click to the grid...but that gets me into a whole host of other problems...usually when that happens, I know I'm doing it the hard way. What is the easy way to do what I need to do?
Give Focus To Winamp Window
I would like to know how to give focus(Higlight) Nulsoft's Winamp window with its ever changing caption...
Give My Application The Focus At Startup
I'm having a problem giving my application the focus at startup. One of my aims is to not allow the user to see any part of windows in the background. As such my application runs first in the registry. However, following this explorer.exe runs and causes my app to lose the focus. Another part of my app is that the touch screen is disabled, meaning the user is stuck. I have tried me.focus after a nominal 10 seconds to no avail. What can I do?
Find And Give Focus To Another Applications Window
I have an application that has 2 full screen report windows open.
lets say "Report A" and "Report B" are the window titles.
I need to have a simple program that swaps between the two windows every 10 seconds.
Any help is appriciated
Give Added Lines To A Multline Textbox Focus?
hey guys I use this code to add new lines to my text10 textbox.
Text10.Text = Text10.Text & vbNewLine & "Scanning in progress...Please Wait.."
But what happens is after so many lines are added, I have to scroll down to see them, is there a way so when a new line is added the user can see it, like the textbox will auto scroll to it or something?
Form Got Focus Or Lost Focus Don't Work
Hi, I have a form that I can't get the Lost Focus or Got Focus events to fire, would anybody know why?
Here is what I am trying to accomplish. I have an .exe vb6 application(MainApp) that opens another .exe vb6(ChildApp) application using the shell command. The main application has a list view with a bunch of records. The ChildApp is used to Insert, Delete or UPdate records from the MainApp. So when an Insert, Update or Delete take place on the Child App, I'd like to refresh the listview on the MainApp because the records have changed. How can I accomplish this? Is there a way to call the form in the Main Application from the Child Application even they are 2 different .exe files? I really need help on this please.
Refresh A Form Not In Focus From A Form That Is In Focus
When in a program with mulitple forms, I would like to refresh a form that is not currently in focus from a form that is currently in focus.
I have a parent form that contains status information. I call a child form to change information that will affect the satus information display.
Currently I go back to the parent that was not in focus, and perform and perform a manual refresh, via a command button which changes the entries in the status line.
All variables in a common module and declared as public.
What instruction process can I use to change information on the parent form when changes are made on the child form.
Give Url From DB To Form Field
Please don't flame me, this has probably already been asked.
But I have a web browser clone that I'm making. The user can set their homepage but whenever the program is closed, it obviously looses that information. So I need a DB to reload the user's homepage when the program loads so it can load the homepage in the browser for them.
I was hoping for just a simple little TXT file it could call the url from. Any help would be greatly appreciated.
Old Problem, Still No Solution? (modal Form Losing Focus When Parent Form Is Minimize
I have a problem with modal forms that's very easy to reproduce, and
practically locks up the application:
When closing Form1 I display a modal from (Form2), more or less to
the user if he's sure, etc. That works fine if Form1 is in normal
state and visible.
If I minimize Form1 in the windows Taskbar before closing it using the
system menu, Form2 appears, but is grayed and cannot receive mouse or
keyboard input. Because Form2 is displayed and modal, I cannot do
else with the application. As far as the user is concerned, it's dead
Form2 does not receive a Deactivate or LostFocus event, where I could
possible "repair" things.
Once Form Opened, How To Shift Back Focus On Sheet While Form Is Still Open?
Once I run my macro and my form is opened, the focus is entirely on the form and I cant select my excel workbook( or any workbook for that matter).
Is there any way that my macro is still runnin, i.e. form is still open (maybe a minimize option..) while i can select and change some values in my workbook..
I tried the myworksheet.activate but it doesnt solve the problem. Any help?
Show A Form On Top Of Another Form, But Keep Focus On The Lower Form?
I've attached a picture of a scheduling section for my applicaiton. The Tooltip window is a seperate form with transparency and no border. I would like the form to show on top of the scheduling form as in the screenshot, but I want the focus to remain on the lower form.
I have seen code somewhere that does this but I can't seem to find it anywhere?
Getting Text To Show Highlights On Form Behind Form In Focus
Title sounds kind of funny. I'll see if I can explain better.
With my text editor, when I have the (Find/Replace) Form up, and I do a Find or Replace... I have it coded to "highlight" the text using .SelLength, however, it doesn't show the text as selected until I switch focus BACK to the main form (by clicking on it, or tabbing). When I click (or tab) back to the find box, the highlighting goes away.
For example, open up Notepad and paste some stuff in it, do a "Find", you'll see when it finds the text, it will be highlighted while the Find box is still in focus.
This is how I'd like my application to behave. Any ideas?
I'm using a RTB control.
Form Subclassing Question...I Don't Want A Form To Get Focus
I have 2 forms.
I do not want one form to get focus.
This can be done by disabling the form...but I don't want to do this and more to the point, I can't do this. I have my reasons.
I am subclassing the form and somehow how have to trap for the "get focus" event.
I think if I ignore this message the form won't get focus...I think
What event is it I'm looking for here? Is there such thing as I a "get focus" event on a form...Hmmmm...It's late and I'm tired.
Giving A Form Focus Over Any Form
I have some forms lets say 5 in this example. then I have a form that appears when something special is done. lets call this FrmSpecail, how do I make it so that this form is always in front of the other forms even if the forms are enabled say that if they click on the other forms this form will not go behind them till they have closed this form.
I tryed this:
form lost focus
but it does not work
I even tryed this on the other 5 forms but nothing happened im quite confused.
I know i could use a timer to make them go to the front which is what i'm doning at the moment but this is a bit rubish really. I wondered if any one know a better way.
Thanks for your help!
Get Focus For My App And Form
First, excuse me for my weak english. I'll try it anyway.
I have written an internet application that shows messages in normal vb forms as soon as it receives the command to do so. The application runs in back and the user is working with an independent application when the message appears.
My problem is: Win2000 does not allow to focus my own form in my own applicaiton anymore. I tried it with various API Functions such as BringWindowToTop, PutFocus, SetForegroundWindow, SetWindowPos... My form starts blinking foolishly in my taskbar, but I want it to get the focus, so the user may click the default button using the ENTER key.
I hope you understand my problem and can bring me further...
Hi, i wanna do something like lock the program. only admin can unlock. when i click Lock, another form will pop out. then how do i make tt form fix on top and not allow to change behind of it. something like keep on focusin the form
How To Know If A MDI Form Is Getting The Focus
I have a procedure that loads a msgbox made by me, that shows itself in a form (that form is not a mdi child) and set enabled to false the MDI form, and when the users click ok, then the msgbox dissapear and return the MDI form to normal
The problem is that when you click in other program and return to click in the vb program you see the mdi form bloqued but you can't see the msgbox (note that the msgbox has the property ShowInTaskBar set to False)
Is there a way to do that when the MDI form get the focus shows the other form?
I have a form that, that get set focus to every so often, by a timer....so when the form get the focus, the MDI form alos gets focus to. Is there anyway to make it so only the form get's the focus but not the MDI form, and MDI childs
the form i am trying to set focus to is not a MDI child.
Set The Focus On A Form
I want to set the focus on my form so that i can use keycodes when i set the tabstop of all objects to false. I know its something like set focus = true or something like that. Can any1 help?
Hum... Well Im making program for project but it needs to be that my form is in focus all times. I mean not vbmodal as that is not what I want. I want that it be in focus over everything, not forms only. I have found lots of posts with this information but I not need vb6, but vb.net... many posts like this: http://www.xtremevbtalk.com/showthread.php?t=187126 do not work in vb.net as it says there problem is with "hwnd."
Can anyone please help for I need this lots. I please apologise for my bad speaking, I live in england only short time but I am practising. Sorry.
EDIT: I am sorry I notice "vb.net General" forum now, for post like this. I would have place it there but my friend said to post it here in so I did not look at other places. I am sorry, Please move post if needed.
How do I know if my form has focus or not?
how can i found out if my form has focus?
Focus On Form
Ok, this one probably is very simple, but im a little slow
how do i bring a form into focus, basically if another form is placed over the top of a form and I click a certain button, that form in the background moves to the foreground. Any ideas?
Keep Form On Top, But Not Got Focus
How to I get a form to stay on top of my programs Main form, but still be able to edit text in the Main form - just like the "Find / Find Next" in VB6?