Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




No Access To Form Unless And Event Occurs On Form W/ Focus


How do I make it so a user cannot access the form that does not have focus unless an event occurs on the form with focus?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Event When Form Gets Focus
Hi everybody,

I've got a form with many controls, that is the only form in my application. In the form there is a ListView with the files of one folder. If I go to the Windows-Explorer and rename the files and go back to my app I want the list to be refreshed. But I cannot find a event which occurs when I come back to my app. Form_Activate and Form_GotFocus don't run.
Thanks for help.

Form Gets Focus Event (RESOLVED)
Hello everybody

I would like to know which event is triggered when a form gets focus. E.t.c. a child form belonging to an MDI form is closed and the MDI form gets focus.

thx, in advance

George Papadopoulos

Change Focus Event For Entire Form
Hello,
Is there an event similiar to the worksheet SelectionChange event for excel that can be applied to all the controls on a userform. To rehash, I'm looking for an event that will occur when focus is shifted from one control to any other control on the same userform?

Form Exit Or Lost Focus Event
I want a form to be displayed that is not modal with a few buttons. If the user clicks on any other form, a different app, taskbar etc, then the form closes - sort of like how a drop down list disappears when it loses focus.

How do I do it? The form Lose Focus event never seems to fire.

Opening A Form But Not Give It The Focus (or Quick Tell Me Wich Form Has The Focus)
Opening a form but not give it the focus (or quick tell me wich form has the focus). Is this possible??

Denying A New Form Focus Access...
just before i ask my first question to u guys, i thought id share this hilarious problem ive been having. since years ago when i started playing around with array's i could never figure out how to send an object array through the arguments section of a sub or a function, however today i got kinda peed off cus i needed it to work so i tried this:-


VB Code:
'assuming you have a shape control with the index set to 0sub setFirstBlack( obj as object)       obj(0).backcolor = vbBlackend sub

ya ya, i know lol. anyways to my next problem.


Im using a form as a hovering infobox that follows the mouse over a ActiveX object, everything works great. however because the infobox is a form, everytime the infobox appears the mdi form im using flashes because its lost focus (i dont want it to do that lol). has anyone in here been able to get round this, and if possible could you please share the method with me.

thanks for reading

SteveB

Log Error Occurs During Form Load
Dear all
I am using ERP base software I have code of software which is properly running on server machine. Now I have to make some changes to modify as per user requirement so copy this code to another machine. But when I double click on form it gives error
“Error during load. Refer to D: final code frm name.log for details”
Also its observed that some of item like combo box are missing on form.

Please say me how I have solve that problem…
Is it require any dll or ocx file ?

Please help me….!!!
Thanks
Prashant

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?

Access Event From Other Form?
Is there a way to make an event happen in a different form? Let's say form 1 has an command that adds something to a list. And then a different form is opened. It has a command. I want that command to have the same effect as the first one. Can i tell it to goto that command?

Old Problem, Still No Solution? (modal Form Losing Focus When Parent Form Is Minimize
Hi everyone,


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
request
the user if he's sure, etc. That works fine if Form1 is in normal
window
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
anything
else with the application. As far as the user is concerned, it's dead
and
frozen.


Form2 does not receive a Deactivate or LostFocus event, where I could
possible "repair" things.

Cheers, Marek

Once Form Opened, How To Shift Back Focus On Sheet While Form Is Still Open?
Hi,

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?

Thanks...

Connecting An Access 97 Form To A Table With Event Prodedure
ok, this my be totally nuts but

I am trying to connect a form to a table in Access 97. the reason I am trying to do this is to verify that the data being entered into the form doesn't already exist in the table. Does that make sense???

Any help will be greately appricated

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 Not Taking Focus On Form.show
I need to know how to make a form not take focus when doing form.show. Thanks for any help you can give me.

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.

Whimper

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.

I Hv Put Window Media Player In Its Own Form...and Try To Access It Form Anotehr Form???
my concept is put window media player into its own form...then i would like to access its from my other form....
for example, i hv 10 form.......i create new form which named is frm11, then i drap window media player from toolbox into frm11.....
then in each of my form(frm1 to frm10) have a button which named"movie"...
and i would like frm1 to frm10 access to frm11's window medai player to play movie clip .for example"dog movie" because each form movie clip is difference.....for example frm3 is cat movie clip...frm 8 is snake,,,,,etc

the reason i would like to put windox media player into frm11 only is becauce i if i attach wmp in each form...my program sleed will be affectd....

thansk for teach me how to slove it...
thanks !!!.

Determine If A Form Is Loaded Without Triggering The Form_Load Event Of That Form
Say you have a form, Form2 that can be called directly from a menu or alternatively from another form, Form1 (in this case it is called modally with Form1 as the owner of Form2).

In the Form_Load event of Form2 I want to determine where its been called from - in particular, if it has been called from Form1.

The following have been tried..

1) Querying Form1.Visible - It seems to attempt to load Form1 (obviously to poll this property) and although it does not show the form it does run part the Form_Load event of Form1 - which I don't want - I simply want to know if it's loaded or not.

2) Querying Me.Owner/Parent - No such properties.

3) "IsNull (Form1)" always returns False.
4) "Form1 Is Nothing" always returns False.

Any ideas? (other than declaring global variables to track them)

P/s - I suppose this is a wake-up call about the programming slackness inadvertently encouraged by the non-strictness of VB, as other truly object-oriented languages such as C++ would no doubt require you to create, manage and destroy individual instances of all objects loaded into memory at run time - including Forms thereby making problems such as this very intuitive to solve.

Status Of Form's Controls At During Form's Init Event
Hi,

Maybe someone can help me out with the following problem in Word:

I have a main form with one combo box and two list boxes.

All these three controls have a common interface class I created called myListControlInt.

This class works always perfectly but in one situation: when I try to set a reference to one of the 2 list boxes from within the Change event of the combo box during the form's Initialize event.

So this fails:


Code:
Set myListControl1.AListBox = Me.ListBox1 '(returns null, not an object)

But this works everywhere else in my application!, even for other combo boxes. This very one's change event is triggered from the form's Initialize event when the error occurs, that's why I suspect the problem lies there...

Has anyone a clue?

(I can email the code to anyone who can help.)

Regards,

Guillermo

Form MouseMove Event Always Firing On Maximised Form
Hi,

I have a maximised form and simply want to detect if the mouse has been moved (so i can reset a timer). My problem is that the event continually fires even when the mouse is not touched. Placing a debug in the event simply prints the debug message continually. How do i get this event to only fire if the mouse is moved?

Heres the code:


VB Code:
'Mak sure the forms WindowState property is set to Maximised first! Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)a = 0 'This line fires continually while the mouse is stationary on the form!End Sub


Thanks for any help

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?

Triggering An Event When An Error Occurs
How would I fire an event when an error occurs in a class module?

Giving A Form Focus Over Any Form
Hello,

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:

Code:
form lost focus
FrmSpecial.setfocus
end sub

but it does not work

I even tryed this on the other 5 forms but nothing happened im quite confused.


Code:
form gotfocus
FrmSpecial.setfocus
end sub

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!

Showing A Form W/i Another Form Load Event
In my form load event (in the default form for the app) there is a possibility that two other forms could be shown (if its an eval version or if no configurations have been defined). The problem I have with this is that neither of these forms show up in the taskbar (hence it's difficult for the user to get back to them if they need to switch to their email to get their license codes). Both have ShowInTaskbar as true (as does the default form that is loading), however I'm guessing that since the main form isn't completely loaded yet that they will not show up in the taskbar. What are my options here? I'm thinking of moving them to the Activate event, but I'm not sure if that will even trigger since the form is minimized immediately and not shown on the screen. Also, would the Activate event trigger everytime someone used the systray popup menu associated with this form? Would it be hoaky to use a boolean variable to check if the sequence of code had already been executed so it only gets launched the first time the form is activated?

TIA

Frances

Unloading Form From Form's Initialize Event
Hello,

I have the following code:


Code:
Private Sub UserForm_Initialize()

Dim AddInsListBox As MyListBox
Dim TitleListBox As MyListBox
Dim UserAddIns As myAddIns
Dim ConfigFile As INIFile

Set ConfigFile = New INIFile
Set UserAddIns = New myAddIns
Set TitleListBox = New MyListBox
Set AddInsListBox = New MyListBox

ConfigFile.Path = ThisDocument.Path & "" & INI_FILE_NAME

On Error GoTo ErrIniAddInsPathNotFound
UserAddIns.AddItemsInFolder ConfigFile.Sections.Item _
(INI_MAIN_SECTION).Keys.Item(INI_KEY_ADDINS_PATH).KeyValue
On Error GoTo 0

Set AddInsListBox.AListBox = Me.lstAddInList
Set TitleListBox.AListBox = Me.lstTitle

TitleListBox.AddRowToList "Complemento", "Instalado"
AddInsListBox.AddRowsToList UserAddIns.BasicInfoToArray("Sí", "No")
AddInsListBox.SelectItemsInList UserAddIns

' AddInsListBox.ResizeListBox LISTBOX_HEIGHT

Set UserAddIns = Nothing
Set TitleListBox = Nothing
Set AddInsListBox = Nothing

Exit Sub
ErrIniAddInsPathNotFound:
MsgBox "No se encuentra la ruta a los complementos."

Dim NewPathToAddIns As String

NewPathToAddIns = UserFolderSelect

If Not NewPathToAddIns = vbNullString Then

ConfigFile.AppendSection INI_MAIN_SECTION
ConfigFile.AppendKeyToSection _
INI_MAIN_SECTION, INI_KEY_ADDINS_PATH, NewPathToAddIns
ConfigFile.WriteMemoryToINI

'vuelve a la línea de código errónea
Resume
Else
Set UserAddIns = Nothing
Set TitleListBox = Nothing
Set AddInsListBox = Nothing

Unload Me ' <<< Offending line: Error 91
End If
End Sub

I'm trying to unload the form (in Word) if the user cancels a folder selection dialog. This operation is done in the error handling routine and it somehow raises an error I can't figure out. Has anyone a clue?

Regards,

Guillermo

Send A Click Event From A Form To Other Form
Hi

I have that to send a Event Click for a Button from Form to other Formm, and call a procedure thar print a report

How can to do it ?


tks

Unload A Form In Form Load Event
i want to unloas a form in form load event

I open some database in form load event,but if database is not their or any error accures then i have to unload the form
without proceding ahead

how i can do that


please help

How To Notify Custom Event Of A Form In Other Form
Hi,

I have two form say form1 and form2 both are displayed simaltaneously. in
form1 i have custom event say datachanged(). In form2 i have declaration of
form1 WithEvent. when i am doing a activity in form1 i will be firing this
event, these event i need to capture in form2. how do i do it?

Could anybody help me in these?



Regards,

Raise Event In Form A, Respond In Form B
I have two forms that I need to communicate between.  The first form (Form A) will take several entries into a listbox.  After each entry into the listbox, I need to raise an event that will tell Form B how many entries have been added currently.  Here's what I have so far (it doesn't work):

Form A:
CODEPublic Event addedNumber(CurrentCount As Integer)

Private Sub txtTrackingNumber_LostFocus()
               
    With Me.txtTrackingNumber
        If .Text <> "" Then
            frmMain.lbxTrackingNumbers.AddItem Me.txtTrackingNumber
            RaiseEvent addedTrackingNumber(TrackingNumberCounter)
            .Text = ""
            .SetFocus
            TrackingNumberCounter = TrackingNumberCounter + 1
        End If
    End With

End Sub

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.

{Closed} Check If Click Event Occurs
I have an application with six controls on it. I want to be able to check if two of a particular group of three have been clicked (disabled). How can I do this? I have...
Code:If control1.enabled = true and control2.enabled = true and control3.enabled = true then
now how can I check to see if controls 1 and 2 have been clicked (disabled)? All six controls are the same kind of control, and all six belong in an array of this control.

Happieman
a.k.a. Bill

Edited by - Happieman on 9/30/2007 10:25:16 PM

Why The Timer Event Doesn't Occurs In My Project ! Help Needed
Hi,

I created a sample project to test whether my mail can be send from VB6 by using Outlook. I am able to recieve the mails, but the timer event did not occurs. I also attached the project. here. Even the DoEvents is used. Kindly can any one reply about it.

Thankyou,
Chock.

Error Occurs When Txtbox Has Setfocus Within Activate Event
Hi

I have a form with a txt box on it.....so in my code, I have placed
the setfocus on the txtbox within the activate event but this appears to return an error..."Invalid procedure call " - as anyone
any ideas?????

Thanks

my code

VB Code:
'set the focus on the txtbox upon form activationPrivate Sub Form_Activate()    On Error GoTo Form_Activate_Error       txtinformation.SetFocus    On Error Resume Next          On Error GoTo 0   Exit Sub Form_Activate_Error:     MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Form_Activate of Form frmscan"End Sub


Thanks

Form Key Event - MDI Child Form
I'm currently developing a MDI application that I am having a spot of bother with respect to capturing User Keystokes to test for the ESC and Return keys.

The setup: Many of the MDI Child forms, there are 90 odd, have some degree of data entry - thus textboxes and the like. With this many forms and thus the number of user input fields I want to use a Global, form level, capture method for testing for the ESC and Return keys. For the MDI Child forms, the Form events KeyPress, KeyDown, KeyUp never fire and of course the MDI Parent form dosn't have any Key events at all. Thus the code I'd normally use is useless.

Any suggestions on how one might impliment some form of Form level Key event?

Raise An Event From One Form To Another Form
Hi Guys:
How to "activate" another Sub from one form to another?

Say: At Form A

Private Sub Dosomething ()
....Activate Donow
end sub


At Form B
Private Sub Donow()

end sub

The objective for my case is to update the data at Form B while Form A is still running. As Form Load will Run only once. I was told using Timer which
I think is not appropriate (am i Correct?), I believe as VB is event related than
I must be able to trigger another event or events somehow...?
using Public Sub() or create a new object?
I search through the forums I can really find the relevant threads.

If anyone could inject some milivolt may be the light bulb wil turn on!

Thanks

Public Event In Form Deactivate Event
How do you make a dynamic array created in the Form Deactivate Event able to be “public” or used in other events such as Form resize event.

Is there another way other than storing the array in a public sub?

Thanks!!

Accessing Variables Or Control Values Of A Form From Another Form - ACCESS
I use MS Access for both front-end and back end. How do I retrieve controls belonging to one form in another in Access. Also, how do I retrieve values of public/global variables that I assign value to in one form from another form. I have referred the net and everywhere I see examples only for VB which does not seem to do the magic in Access. Can anyone please help?

Combobox On Access Form To Populate Form With Record
Hello code masters
I have a database using Access 2k and some VBA. I want to use a combobox to go to a record and populate my form with that record. Currently I have another form I can go to from this one that has a listbox that will allow me to do the operation I just described. But I can’t seem to duplicate it from the main page. I guess that is a separate issue for now I would like to get the combobox working. This code works in another program I have.
Some names I’m using
frmContacts
tblContacts

So far I have…
Code:
Option Compare Database
Private Sub cboFirst_AfterUpdate()

    ' Find the record that matches the control.
    Me.RecordsetClone.FindFirst "[ID] = " & Me![cboFirst]
    Me.Bookmark = Me.RecordsetClone.Bookmark

End Sub

Private Sub cboFirst_Enter()
   cboFirst.BackColor = 16777215 ' Change background to white.
End Sub

Private Sub cboFirst_Exit(Cancel As Integer)
   cboFirst.BackColor = 12632256 ' Change background to gray.
End Sub

Private Sub ShowRecord_Click()
' find selected record
    With Forms!frmContacts
          .RecordsetClone.FindFirst "ID = " & lstFirst
          .Bookmark = .RecordsetClone.Bookmark
    End With
' close dialog box
    DoCmd.Close acForm, Me.Name
End Sub

this is what I have in the combobox properties – Row source - SELECT DISTINCTROW [tblcontacts].[ID], [LastName] & ", " & [FirstName] AS Expr1 FROM tblcontacts;

I click on the combobox and nothing happens.

Hal

Perform A Requery On A Continuous Form From Another Form In Access 2K
Hi,

This one should be easy ... (Not like my usual brain busters ...) I have a review form (list of say Suppliers ...) This form is a continuous form. From this form you may go into a detail/entry form for the supplier. My questions is after adding/updating the specific supplier I want to "refresh" the parent form ( list of suppliers ) from the child form. Now I know about the Requery method but how to invoke it from the child to affect the parent?

Thanks!

- Mike

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...

yours, Daniel

Form Focus?
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
Hi all

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?

Set Form To Not Focus
Is there a way to set a form to not focus?

Form Focus
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.

About The Focus Of A Form
Any one know how to program to make a form get focus?

please give me some advice!

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?

Form Focus?
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.


Thank you
Raaj


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.

Form Focus
How do I know if my form has focus or not?

Thanks, Spyru

Form Focus
how can i found out if my form has focus?
thx

Copyright © 2005-08 www.BigResource.com, All rights reserved