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




Key Form AND Modal Windows On Top


Here's my problem:

I've got a frmMain that I'd like to remain on top. From previous posts, I've learned how to keep this window on top of all others. However, at various points, this form launches various modal "response-type" windows, using the standard code: "frmResponse.show vbModal, me". The problem is that these forms don't show up. If I set the main window not be be on top, then launch form, the new form is visible, but I lose the effect of keeping the application on top of other applications. I don't want to use MDI windows if I can help it.

Is there a solution to this?

Many thanks in advance!

Cheers!




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Modal Form Not Diplaying In Windows Taskbar??
I have been going through forms in an application that dont display in the taskbar, thus not allowing a user to alt+tab back to the application if they try. One property that I changed that solved the problem in some forms is changing the borderstyle for the form from fixed toolwindow(The form does not appear in the Windows taskbar- by msdn definition) to say fixed dialog. Now that only worked for some of the forms others still wont show in the taskbar. Does anyone know of other properties that may affect this problem.

Call Windows Application In A Modal Form
     How can i call a windows application (ex. WORD) in modal form....

    meaning The user cannot go to any other place if they dont close the application (ex. WORD)

      I'm using this code to call WORD.

    Code:ShellExecute 0, vbNullString, FileName, vbNullString, vbNullString, vbNormalFocus

     Thanks for your help.

Open Windows ODBC Manager Form In Modal Mode
I have a program which need to call the windows ODBC Manager program . How can i open it in modal mode, since the form that call the ODBC already in model mode

Thanks

What Does This Error Mena - Cant Show Non-modal Form When Modal Form Is Being Display
cant show non modal form when modal form is being displayed - whats does that error mean? and how can i fiz it?

Run-time Error '401': Can't Show Non-modal Form When Modal Form Is Displayed
What does this error message means?

Code:Run-time error '401': Can't show non-modal form when modal form is displayed

?

Runtime Error 401 Can't Show Non-modal Form When Modal Form Is Displayed
Hey guys !

I am going crazy due to this (Runtime Error 401 Can't show non-modal form when modal form is displayed)

This error doesn't occur while I test the software in the VB run mode... only when i run the exe !

Any ideas why this is happening ?

chao





Edited by - pingu2k on 2/20/2007 6:00:02 AM

Can't Show Non-modal Form When Modal Form Is Displayed??? Only When Burned On Cd
Hello guys, i have this problem:
When i burn my program on cd and try to run it i get this error: Can't show non-modal form when modal form is displayed
then if i click OK another error: unable to find d: extfile.txt even if the drive where the cd is e:

to open the txt file i use this code:

Open App.Path & "ookmarks.txt" For Input As #1

any suggestion???

thanks in advance

ah... when executed from hard disk everything works fine

Run Time 401 Cant Show Non-modal Form When Modal Form Is Displayed
When i run the software i received this error, what will be the caused of this error ....
run time 401 cant show non-modal form when modal form is displayed


Thanks

Converting A Modal Form To Non-Modal And Vice Versa
Hi 2 All,

I am facing a very peculiar problem. I have one application which shows one form as modal. Then that form is calling a method in an referenced component and that intern shows another form as modal. Unfortunately, two modal forms can be displayed one top of the other. How do handle this?

Expecting experts to drop few lines.
Nazim.

Show "Waiting" Form (Non Modal) When Click On Button From Modal Form
Hi,

I have a modal form with a button. When I click on this button, it take a long time because it's doing a SQL query. During that time, I would like to show a form with a message on it to let the user know that it taking some time.

As the first form is modal (and it should be modal), I can't show the second form non modal (form2.show generate an error 401, because the first form is modal form.show 1).

If the second form is modal, it's doesn't show until the form load is fiinished. But I WANT that the form2 is shown in first and after proceed with some code in the form1.

How can I resolve my problem?

Thanks

Dominic Lavoie
City of Laval
Quebec, Canada

"Run-time Error '401': Can't Show Non Modal Form When Modal Form Is Displayed"
"Run-time error '401': Can't show non modal form when modal form is displayed"

That error is VERY annoying. How can I stop it?

Can't Show Non-modal Form When Modal Form Is Disp
Can't show non-modal form when modal form is displayed in vb 6.0.

Can't Show Non-modal Form When Modal Form Is Displayed
Within a timer, I tried to display a modal form but there is not any non-modal form that is going to be displayed. But I got this error "Can't show non-modal form when modal form is displayed". Any guru here can explain to me what might cause this problem. Thanks for your inputs!

"Can't Show Non-modal Form When Modal Form Is Displayed" Error!
Ok, I'm coding a game in VB6, and I have a slight error with the hall of fame...

When the program is ran in VB6 (Not Compiled), this problem doesnt happen. When compiled, is when the error occurs.

Here is the story...

You can acess the hall of fame two ways. One being from the main menu, the other being from when you die in the main game.

When acsessed from the main menu...

http://www.freewebs.com/vagjd/prob1.JPG

It works fine. It sorts the sequential files from highest to lowest, it works perfectly.

http://www.freewebs.com/vagjd/prob2.JPG

When acsessed from the game, when you get game over...

http://www.freewebs.com/vagjd/prob3.JPG

It gives this strange error...

http://www.freewebs.com/vagjd/prob4.JPG

.
.
.
.

Also, I'd like to note that when games is equal to false (User is acsessing the hall of fame from the main menu) is when the hall of fame works.


Quote:




Dim nmes(6) As String, times(6) As Variant, ttemp As Variant, ntemp As String, uname As String

'***note***, the variable games is globaled in a module, and
'is used to determine weather the user acsessed the hall of fame from the
'user losing in the game, or the user selecting hall of fame from the main
'menu

Private Sub cmdone_Click()
HallofFame.Hide
Menu.Show
End Sub

Private Sub Form_Activate()
If games = True Then
soundcheck = 1
Intro2.Show
Intro2.Hide
uname = InputBox("Please enter your name", "High Score Listing")
If uname = "" Then
uname = "Unnamed"
End If
End If


'Easy Settings
If opts(1) = 0 Then
lbltitle.Caption = " Hall of Fame Easy"

If games = True Then

'adds the new time to the file
Open App.Path + "ehighscore.txt" For Append As #1

Write #1, uname, thetime

Close #1

End If


Open App.Path + "ehighscore.txt" For Input As #1

x = 1

For x = 1 To 6
nmes(x) = ""
times(x) = ""
Next x

If games = True Then

For x = 1 To 6
Input #1, nmes(x), times(x)
Next x

Else


For x = 1 To 5
Input #1, nmes(x), times(x)
Next x

End If

End If


'Normal settings
If opts(1) = 1 Then
lbltitle.Caption = " Hall of Fame Normal"

If games = True Then


Open App.Path + "
highscore.txt" For Append As #1

Write #1, uname, thetime

Close #1

End If


Open App.Path + "
highscore.txt" For Input As #1

x = 1

For x = 1 To 6
nmes(x) = ""
times(x) = ""
Next x

If games = True Then

For x = 1 To 6
Input #1, nmes(x), times(x)
Next x

Else


For x = 1 To 5
Input #1, nmes(x), times(x)
Next x

End If

End If

'Hard Settings
If opts(1) = 2 Then
lbltitle.Caption = " Hall of Fame Hard"

If games = True Then


Open App.Path + "hhighscore.txt" For Append As #1

Write #1, uname, thetime

Close #1

End If


Open App.Path + "hhighscore.txt" For Input As #1

x = 1

For x = 1 To 6
nmes(x) = ""
times(x) = ""
Next x

If games = True Then

For x = 1 To 6
Input #1, nmes(x), times(x)
Next x

Else


For x = 1 To 5
Input #1, nmes(x), times(x)
Next x

End If

End If


Close #1


'Sorting Process

'If loaded after playing the game
If games = True Then


For y = 1 To 5

For x = 1 To 5


If times(x) < times(x + 1) Then
ttemp = times(x)
times(x) = times(x + 1)
times(x + 1) = ttemp

ntemp = nmes(x)
nmes(x) = nmes(x + 1)
nmes(x + 1) = ntemp


End If

Next x

Next y

'if loaded from the menu
Else

For y = 1 To 4

For x = 1 To 4


If times(x) < times(x + 1) Then
ttemp = times(x)
times(x) = times(x + 1)
times(x + 1) = ttemp

ntemp = nmes(x)
nmes(x) = nmes(x + 1)
nmes(x + 1) = ntemp


End If

Next x

Next y

End If

For x = 0 To 4
lblname(x).Caption = nmes(x + 1)
lbltime(x).Caption = times(x + 1)
Next x



'Writes the new highscore list to the file.

If opts(1) = 0 Then


If games = True Then

Open App.Path + "ehighscore.txt" For Output As #1

For x = 1 To 5
Write #1, nmes(x), times(x)
Next x

Close #1

End If

games = False


ElseIf opts(1) = 1 Then


If games = True Then

Open App.Path + "
highscore.txt" For Output As #1

For x = 1 To 5
Write #1, nmes(x), times(x)
Next x

Close #1

End If

games = False

ElseIf opts(1) = 0 Then


If games = True Then

Open App.Path + "ehighscore.txt" For Output As #1

For x = 1 To 5
Write #1, nmes(x), times(x)
Next x

Close #1

End If

games = False



ElseIf opts(1) = 2 Then


If games = True Then

Open App.Path + "hhighscore.txt" For Output As #1

For x = 1 To 5
Write #1, nmes(x), times(x)
Next x

Close #1

End If

games = False

End If

End Sub

Private Sub Form_GotFocus()
cmddone.SetFocus
End Sub

Private Sub Form_Unload(Cancel As Integer)
Unload Menu
Unload Intro2
Unload Instre
End Sub




.
.
.
.

Thanks in advance

Making Modal Form Truly Modal
I'm working in VB3 (I know!) but I think this applies to other versions of VB as well...

I have an MDI form which sometimes pops up modal non-MDI forms. When this happens, if the user gives focus to another application and then clicks on the icon of the MDI form, no action is permitted on the MDI form since another modal form is currently open.

What I need to know is how I can code/configure the program such that if the MDI form is selected from the taskbar when a modal form is opened, that the modal form is brought into focus on top of the MDI form.

This is donde in programs such as Word 97.

Thank you,
Craig Steiner

Open Non Modal Form From A Modal
Hi,
I need to open a non modal form from a modal one.
If i use the function "Show", it gives an error that it cannt be done.
Do u know a way to do it?

Thanks in advance

Displaying A Non Modal Form On Top Of A Modal Form?
Forgive me if this is a dumb question. My searches turned up little.

What I need to do is display a form asking the user to stand by. This happens when they bring up a modal form from the main app (so three total forms). The 3rd form asking the user to stand by needs to be non modal since the 2nd form needs to do some lengthy communication processing. Of course, VB wont allow a non modal form to display when a modal form is already displayed... I cant just bring up the 3rd form first because the second form will periodically refresh the communication processing (at which time the wait message needs to be displayed again).

Anyone have a way of doing this? What am I missing??

VBA And Non-Modal Windows
Hello All,

Just wondering if anyone knows if there is a way around the Non-Modal limitation of VBA. I guess it makes sense that you cannot create non-modal windows, but I wanted to be able to create a non-modal child window from a script. I tried creating an ActiveX .DLL with a Non-Modal window and calling it from the VBA engine (Sax to be specific) and I got an error.

Alternatively I was thinking; Is there a way to create a window using API calls and have that window do it's own thing without VB running? For example, I would like to be able to create a window that has a button and have that button call another function (maybe an API call) without having the original VB App that created the window running?

Thanks for ANY ideas!

Modal Dialog Windows
has anyone ever tried to pass an array to a using window.showmodal?

Closing Modal Windows??
My app closes itself at a certain time of day if it is still running. It is an MDI app which can have quite a few child windows open, and also in certain circumstances also a modal window.

If the modal window is open at the time it is supposed to close the app, an error is generated ...

Run-time error '400'
Form already displayed, can't show modally.

This is probably because the error caused when trying to close the windows, brings up an error message which I display in a custom modal messagebox.

How can I get past the initial error and close the modal window if it is open?

Modal Windows Problem
Hi, i'm going to explain my problem.

I have a modal form, this modal form open another modal form, and now the problem is sometimes i need to open , in modal, a form that is already show modal on back and vb throw me an error.

There's anyway to do this?

Thanks in advance.

PDF Creation App And Modal Windows
I am trying to automate the conversion of word docs to pdfs. I am having my vb app print to the adobe distiller. The problem is that the distiller prompts for a target to save the pdf to. My app will get the hwnd of word and would get the hwnd of the "save as" dialog, but it is a modal window and my app will not continue until I close it. Anyone have a solution to my problem? Thanks.

Modal/Non-Modal Form
When I run my code from VB I don't get this problem, but when I try to run the .exe I get an error that says "Can't show non modal form when modal form is displayed". I don't have anything set to non modal or modal. Can anyone help me?

Thanks!

Surpressing Modal Windows Messages?
Dear All,

Does anyone know how I can make sure my program does not encounter problems with modal windows messages? Is there any way to block them?

Thanks in advance,

Cheers

Gwyn

Modal Windows Dialog Boxes?
i displayed the windows Internet Settings dialog box, but i want it to be modal so that the user can not switch to any of my other forms/windows until the dialog box is dismissed. any way please
thanx
dayo

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

Normal Form And Dialog / Modal Form Sharing A Taskbar Item
My situation is I have a normal form (aka not a modal form), and a modal form that serves as an about window. When you show the modal form, all the items in the task bar lose focus. If you switch windows, and then go back to the 1 taskbar item for my program, again the taskbar item for my application loses focus and no taskbar item has focus.

I'm trying to make my application do the same thing as Word (for example). If you show the About window, the About window always has focus until you close it, but both the application window and the about form "share" the taskbar item, so when you click on Word in the taskbar, it doesn't lose focus.

Is this possible in Visual Basic 6?

Thanks in advance,
L. Whiteside

Block Form From Loading If Another Specific Modal Form Is Loaded [RE-SOLVED]
How can I block a Form from loading when another Form is loaded as Modal? The second Form is loading automaticaly if there is an error to report but if the Modal form is Loaded it's causing an error.

How can the program know that the first modal Form is Loaded before loading the second?

I've tried several approaches but non seem to work....

Thanks

_________________________________________________________________

Edited by - vbprog1144 on 8/7/2005 6:31:26 AM

How To Change Properties Of The Parent Form From A Modal Child Form, Plz?
I want to open a child form windows (frmPortSetting) and from there changing some ActiveX components properties (comTx) which are on my parent form (frmMain).
I wrote code in frmPortSetting sub procedure but it seems that I can't change comTx properties directly there. (e.g. comTx.settings(9600,n,8,1)) Any advise please?

How To Change Properties Of The Parent Form From A Modal Child Form, Plz?
I want to open a child form windows (frmPortSetting) and from there changing some ActiveX components properties (comTx) which are on my parent form (frmMain).
I wrote code in frmPortSetting sub procedure but it seems that I can't change comTx properties directly there. (e.g. comTx.settings(9600,n,8,1)) Any advise please?

Calling A Modeless Form From A Modal Form
how can I do this? I saw something in MSDN about calling it as a child, but I tried

Code:
no.show (vbmodal,lissel)
'no is the name of the modeless form and lissel be the
'parent, the modal

argh...thanks for the help!

Get The Parent/Owner Form Of A Modal Form
Does any one know how to get the Parent or OwnerForm of a Modal Form?

I am using the Forms collection to unload all forms in application exit.


vb Code:
For Each frm In Forms        If frm.name <> CurrentForm.name Then            Unload frm            Set frm = Nothing        End If    Next frm


But this hangs when the current form is a modal Form (the Login Form) showed uppon another form. The reason (as I guess) is that above code is trying to unload the Parent of the current form which wont unload until this current form is unloaded. If that is so,it'd create a dead lock situation.
And I call this code in QueryUnload. So is there any method to get the name of the modal Form's parent ?

Thanks In Advance

Owner Form: How To Determin The OF Of A Modal Form?
I have a Form that I want to open modally from different other forms like this:

frmModal.show vbmodal, me

How can i determine which from which form the frmModal was shown?

thx,

Helger

To Display A Nonmodal Form From A Modal Form
Hi everyone,

Can someone tell me how to display a nonmodal form from a modal form? So that I can switch between the two forms.

Showing A Topmost Form From A Modal Form
Does anyone know how to show a topmost form from a modal form?

The effect I wish to achieve is a floating toolwindow over a modal form.

I am using the SetWindowPos() api to make the child form topmost ie floating. This works fine when the parent calling form is itself is shown non-modal. However when the parent form is shown modally I get a stack overflow error and a GPF.

Any help much appreciated,

Avinder Bahra

Avinder Singh Bahra

Modal Form Vs. Non-Modal Form
What is the difference between them?

Modal Form
Hi,

I want the form to be loaded modally without using vbModal property. ie
When the form is loaded, form should act as modal form not using the property for that. Can anyone help in this?

Modal Form
I have created a class that does some processing via loops. To improve the user interface I have added a form with a progress bar so that the user can the see the application is doing something and has not crashed. The problem is that I want to make the form modal so the user can't do anything while processing occurs. However if I call the progress form using vbModal execution of the code pauses until the form is unloaded. Does anybody have any suggestions on how I could get around this?

Modal Form - Help
Hi!

I want to timeout the user from an application after MAX_TIME.
I want to unload the main form when MAX_TIME has reached. But I want to leave a msgbox to the user with a message "Your application has been timed out".

How can I unload the form and still leave a msgbox open. Could somebody please help.

The below code doesnot work because, it unloads the form and never throws the message.

Unload frmCIRMS
MsgBox (" Your Application session has been timed out.")

If i move the msgbox above "Unload frmCIRMS",
it will wait for the user feedback before it timesout. I want to exit main form without waiting for the user feedback.


Thank you for your time

Modal Form
Hi

I have a MDI form where i want to display a mdi child. but i want this child to behave like 'modal()' so the user can't get out the form when it is not completed correctly.
Edited:
When i import a dialog and show it after pressing a menu item in the mdi parent ... then the dialog is shown when i minimaze the mdi parent.
What's the problem here? :s


And another little thing
I dont' seem to find a method for deleting an entry in the listbox :x

You guys can help?

Greetings
Jens

Modal Form In MDI
Hi All,
My application is an MDI, i am trying to lock the system in a particular time if my system is Idle..Am using a Modal Form to get the password and open the system...

My problem is if the application is idle in minimized state,the password form appers outside the MDI application since it is not a child form(as it cannot be showed modally)...

Plz help me to overcome this.....

Help With A Form Modal?
I want two forms to be displayed at the same time. The first one to be the main form and then the second form to be the document form or the like.

How am I able to call two forms to be on the screen at the same time. I have tried Form2.Show, in the Form_Load of the first form. But that doesn't work, so I have been told.

Also I wish to jump from both forms at any time, the user wishes to do so.

Modal Form
The start-up Form in a VB6 app is Form1. This Form has a TreeView. When any node in the TreeView is right-clicked, a menu pops-up. Clicking a menu item opens another Form named Form2 which should be a modal Form. Users can open multiple instances of Form1. This is how I am invoking Form2:


Code:
Form1:

Private Sub mnuTV_Click()
Dim frm As Form2

Set frm = New Form2
If Not (TreeView1.SelectedItem Is Nothing) Then
Call frm.ShowMe(Me, TreeView1.SelectedItem)
End If
End Sub

Form2:

Private frmOwner As Form

Public Sub ShowMe(OwnerForm As Form, TNode As MSComctlLib.Node)
Set frmOwner = OwnerForm
Me.Show vbModeless, frmOwner
frmOwner.Enabled = False
Call GetTVNodeSelected(TNode)
End Sub

Sub GetTVNodeSelected(Node As MSComctlLib.Node)
Dim str1 As String
Dim str2 As String

str1 = Node.Text
str2 = Node.Tag

'more code here
End Sub

Private Sub Form_Unload(Cancel As Integer)
On Error Resume Next
frmOwner.Enabled = True
Unload Me
End Sub
The reason I am not using the code


Code:
Form2.Show 1, Me
to invoke Form2 (in the mnuTV_Click() sub) in Form1 is because since users can open multiple instances of Form1 (which means multiple TreeViews can be visible at the same time), assuming that 2 instances of Form1 are open, when Form2 is invoked in any of the 2 instances, it will act as a modal window for both the instances of Form1 instead of being a modal window for only that instance of Form1 from which Form2 has been invoked.

But under some conditions I find that even though all instances of Form1 & Form2 are closed, the app doesn't unload completely. An instance of Form1 still continues running & its icon in the Taskbar still exists.

How do I ensure that when all instances of Form1[ & Form2 are closed, the entire app gets unloaded?

Note that this doesn't happen always; only sometimes. I couldn't unearth under what circumstances does this happen. Moreover, if Form2 is never invoked & multiple instances of Form1 are open, then closing each instance of Form1 unloads the app completely. This happens only when Form2 is invoked; so I guess it is Form2 which doesn't unload itself even after all instances of Form1 & Form2 have been closed.

Modal Form
i have a timerecorder.exe

when i run it it i can time in and timeout. it has afunction key also (F9) for
opening another .exe file. which is DownloadApp.exe.
where in i can down load a file from a USB. what i want is when i click F9.

timerecorder is not unloaded but cant be clicked or cant do anything until the transaction in DownloadApp.exe is finished... how can i do that?


any help?

Modal Form
Hi
I have an alarm program that alerts the user that he has a meeting before 15 minutes.Every 5 minutes the Timer1_Timer checks if there is a meeting in 15 minutes.If the frmalert appears on the screen and the user doesn't notice her than after 5 minutes the same form will appear telling the user about his meeting.I show my form modally so If the form still in the screen without the user clicks on it after 5 minutes a message appears telling the user"
"Can't show form modally because it's already shown".
what's the solution?
thanks

VB Modal Form
Hi,

I have a movie_details form (main - frmMovies) which has comboboxes cboGenre, cboLanguage, cboCast. Each combobox has a command button next to it. In the event that an item you expect is not listed, then, one clicks on the command button and another form (frmSupport), in VBmodal form, opens and a ListView lists all entries in the particular table. One is allowed to add a new entry before closing it. After closing the form, it should refresh the respective combobox in the main form.

Each combobox represents a table in the DB. The frmSupport form is same in layout the only difference is that it lists the entries depending on the command button clicked on in the main form. Eg, if i click on cmdGenre, then the corresponding frmSupport will list entries in the genre table. If i click on cmdCast, then the cast table items will be listed.

Can I re-use one frmSupport to display the different items in different tables depending on the cmdButton clicked on (in the main form) or should I have individual frmSupport forms to represent each table? If it is possible to re-use one frmSupport form, how can I implement this starting from the Main form?

Thanks.

Modal Form
good day.

how open modal form
whith do all rest forms not enable if this form is not closed?


thank's.

Is This Form Modal?
Is there anyway to tell if a particular form is modal or modeless?

Is there a property of the form I can check? Or perhaps some other way?

Min/max A Non-modal Form
I need to make a modification to an existing command-line version of a program that shows the progress of the processing happening.

Right now, the startup object is a basic module which instantiates a class and calls a function in the class that processes a number of files. No form is shown when this occurs.

I want a small form to show, with a progress bar and some text that describes what's happening. I invented a way to do this using WithEvents in the progress-form paired with raise events in the class and public subs in the progress-form called by the basic module.

This technique seems to work, except that since I have to show the form non-modally, I am not satisfied with how I cannot seem to minimize/maximize it while it's running. The problem is that I can minimize it, but I can never get it off the taskbar again.

If you set the form's initial state to 'minimized', it starts up in the taskbar minimized, you can maximize it, minimize it, and then that's it. You can't get it out of there again.

Any ideas? I am attaching a sample program that mimics the technique and shows the problem.

I am trying to do it this way so I don't have to move the setup before calling the class's processing code to a form.

I've read things like this before on this forum and always say "what the heck are they talking about?" . I hope I have made sense out of it.

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