Calling Showdialog() On A Form - From The Main Form's OnLoad Event Makes The Modal Dialog Go Away After A Few Seconds?

Aug 7, 2009

I'm having an interesting issue that I can't reproduce on a different project, but can consistently on this one. I have no clue what might be causing it, but am hoping that someone may have seen it before.

I have a main form, from which I run a series of checks. On this form, I have a listview control. Because of some issues with the refreshing of this listview control, I had to create my own messagebox. It's just a form that displays some text ( it also happens to look nicer than MsgBox; in my opinion, anyways ). It's been working great for months, until recently.

My problem is that on my main form's load event, I run this check, which returns an error within a try/catch block. I then call my custom messagebox with a message. It in turns calls it's ShowDialog() function.

In any other situation ( after the main form has been loaded ), I have no problems. The messagebox goes on the screen and behaves appropriately ( ie: waits for my input and acts as a modal dialog ( stops execution of my main form's thread ) ). However, on this onload event, my messagebox comes up and goes away almost immediately afterwards.

I've traced it all the way to the showdialog() call. For no explicable reason, it appears to skip right over this call, without me doing anything on the form.

Here's what the inner trace looks like ( when I put a breakpoint on the onclosing event for this messagebox form ):

CODE:

View 10 Replies


ADVERTISEMENT

Find When Dialog / Modal Form Is Shown For My Main Form?

Feb 3, 2010

I want to be able to check if there is currently a dialog or modal form shown for my form so that I can close it.
Is there a way to do this?

View 1 Replies

.net - Main Form Minimized When Modal Dialog Calls Me.Hide()?

Mar 22, 2011

sometimes (not everytimes), when I call the Me.Hide() in a form, which I called with .ShowDialog(), the main form, which called this dialog minimized.

View 2 Replies

Open A Form As Modal Without Using Showdialog()?

Feb 11, 2011

I want to open a form as modal without using showdialog()Problem with showdialog() is we can not open the form as mdi child with it. i want to open few forms as modal but as mdi child forms. but i want to make sure user cannot go anywhere else without closing thst form.if we set parent form enabled = false then i can not set it as mdi child otherwise that form also becomes enabled=false.

if we write showdialog() then so many form icons will appear on taskbar. it we open as mdi child then only one icon appear i don't want to appear so many icons on taskbar so i want to open as mdi child but as modal

for eg. Mainform = mdi form
from mainform open formA = as mdi child of main form (but modal)
from formA open formB as child (modal)
from formB open formC as child (modal). if i use showdialog() then so many form icons on taskbar.
h2007

View 4 Replies

Mdi Form And Show Form - Error "Form That Is Already Visible Cannot Be Displayed As A Modal Dialog Box"

Jan 26, 2010

I'm new in .Net and I have an application with windows form "LOGIN" When users enter the user and password and click "ok", then if user passes validation then I have the code Show(MDIMainMenu) (I'm trying to open an mdi form), but I receive the following error: "Form that is already visible cannot be displayed as a modal dialog box. Set the form's visible property to false before calling Show. Error Number 5"

[Code]...

View 2 Replies

Background Worker In Excel VSTO Application, Modal Dialog Makes BGW Cancellation Slow

Nov 25, 2011

I'm using a background worker to in an Excel VSTO application to throw up a progress dialog box with a status bar and a cancel button to escape from long running calculations. It's working really well, except for one issue. I'd like to use a Modal Dialog, so that the UI behind the dialog gets locked up, instead of a Modeless Dialog. If I use .ShowDialog() instead of .Show(), everything is great until you hit the Cancel button on the form. Following things in the debugger, the cancellation happens, it just takes somewhere in range of 30 seconds. If I use .Show() on my form, then the cancellation occurs immediately as it should.

[Code]...

View 2 Replies

Error While Showing A Modal Dialog Box Or Form

Jun 23, 2009

I am checking emailId exists in DB, If ExistsI am looking to create a Ok/Cancel confirmation dialog.if user say "Ok" I am redirecting to some other form.[code]...

View 3 Replies

[2005] How To Use Bindingsources From Main Form On Dialog Form?

Mar 2, 2009

My project has a single dataset with about 6 datatables. Each of those datatables has a TableAdapater and a Bindingsource on the main form (due to various databound controls).

Now, I want to have a second form for adding a new record. If I bind the controls to the datasource it creates new TableAdapaters and new Bindingsources on that form. I was wondering if it's possible to simply use the ones from the main form instead like this

[code...]

View 3 Replies

Minimizing A Modal Form Minimizes Parent Or Main Application?

Jun 2, 2009

Is it possible to have an application where form1 opens a second modal form (form2) and then allows the user to minimized form2 causing the entire application to minimize to the taskbar.(form2 is never shown in the taskbar) A simple example of this is winzip where a second modal progress window is opened which can be minimized?

View 10 Replies

Modal Dialog With Secondary Form Shown In Taskbar?

Jul 21, 2009

I have two forms for my application, that are visible in the Windows taskbar. When a modal dialog is popped up on the main form, the secondary form is locked. However, when the user clicks on the secondary form on the taskbar, it appears over the modal dialog box, and is basically frozen. Is there a way to ensure that the modal dialog box does not draw underneath the secondary form? The topmost property is no good, since this draws on top of everything, even stuff not related to the application.

View 1 Replies

VS 2008 : Modal Form Hide Instead Of Close - Main Form Does Not Close

Mar 20, 2009

I have a main form that has a button with which a smaller form is shown. Think of the smaller form as the Find/Replace dialog in many applications, such as Notepad. It's important that the form is (what I believe is called) modal. What I mean is that it always stays on top of the main form. I ensure that by calling the Show method with "Me" as the owner argument. Whenever the small form loses focus it will not disappear into the background but stay visible (albeit out of focus). If you don't understand open up Notepad and have a look at the behavior of the Find/Replace dialog.

Here's my problem: instead of actually closing the form when the X is pressed, I want it to simply Hide itself, so its position and the state of any controls (checkboxes etc) is preserved automatically.To achieve this I simply cancel the FormClosing event and Hide it:

vb.net
Private Sub Form2_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing

[code]....

To show the form, I use the following (note the (Me) to make the main form the owner of the form; this ensures that it remains visible even when it is out of focus):

vb.net
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Form2.Show(Me)
End Sub

Now. When I run my project, and open the Form2 (small form), then hide it again (by 'closing' it), I can no longer close the main form (Form1)! It seems the main form cannot close when the small form still exists (albeit invisible)...?? When I don't use the Me argument in the Show method, I don't get the behavior I want. I know I can set the TopMost property to True but that will also cause it to become visible on top of all the other forms, even windows not part of my application.

View 8 Replies

Main Form Is Closing By Itself After 15 Seconds

Mar 10, 2012

Everytime I execute my program, the main form closes by itself after about 15 seconds. The code is not the problem because it does the same thing when I put the whole code in comments. It's also not a key problem because it closes by itself even when I don't touch a single key when it's running.

View 1 Replies

Showing A Modal Dialog Box Or Form When The Application Is Not Running In UserInteractive Mode Is Not A Valid Operation?

Sep 5, 2008

I am writing a web application using .net 3.5 and vs 2008 which allows people to add data to a db via a control panel front end.Objective: Before committing one of the fields to the db i would like the user to answer Yes, No or Cancel to confirm their action. I have tried to implement this with a modal dialog box or message box but the following error appears: Server Error in '/' Application.

View 10 Replies

Calling The Classes To Be Used In The Main Form?

Apr 3, 2012

I have an original assignment that works fine, now I need to go back and make it into classes. I am not 100% how to do this. My issues are with calling the classes to be used in the main form, and what to put into the classes.

I will post the original working assignment and my understanding of the classes.

[Code]...

View 7 Replies

Minimimizeing Main Form While Dialog Is Open?

Oct 15, 2011

How can I have the Main Form of my app mininized while a Dialog is stil open and avalable for resieving text from the user.

View 4 Replies

Stackoverflow Exception Thrown When Calling Me.close() On Main Form

Apr 3, 2009

I have done some reading and it seems that this error comes from recursive calls but I have not done anything in my form_closing handler except for call me.close, that's it.

So I don't understand how this exception has entered my project. All of my data and functionality is still working as I expect. It just seems to throw this exception when I try and exit my project.

what I could check to prevent something like this from happening?

View 3 Replies

VS 2008 - Show As A Drop Down Does Not Appear To Take The Focus Off The Main Form That Is Calling It?

Nov 3, 2009

Q1: How can i make it so that my window that i want to show as a drop down does not appear to take the focus off the main form that is calling it?

Q2: The form that is dropping down has the FormBorderStyle Property set to None - thus the window does not have a drop down shadow - how can I make the popup window have a shadow?

View 1 Replies

VS 2008 Make Main Form Inaccessible Until User Closes Dialog Box?

Apr 11, 2010

A program I'm developing launches dialog boxes to get information from the user. Right now, the user can still click on and manipulate the main form while the dialog box is open. How can I make the main form inaccessible until the user closes the dialog box?

View 2 Replies

Interface And Graphics :: Dialog In Center Of Calling Form

Jun 17, 2009

I've got a question and i think its very simpel but i don't get it.

I've got 1 form that is a MdiContrainer for other forms that i'm opening.

(lets say: the main program)

In the main program, i'm opening a form with a datagrid in it (configuration form). If i click on one of the data cels I'm calling a otherform as a dialog to edit some of the value's from the data cel thats just clicked.

But the problem is, when showing this form as a dialog, with the property startposition: Centerparent it displays it as in the center of the main program and not from the calling form. How can you correct this? Because i'want the dialog in center of the calling screeen.

dialog.parent = me: wont work

see attachment for the program.

View 5 Replies

Inter-form Communication - Form Being Called Form Several Forms Using ShowDialog()

Mar 28, 2011

I have a form being called form several forms using ShowDialog().

1. Is there a way for called form to know which form called it by receiving a code or key from the calling form?

2. The calling form has a gridview. How can the called form pick up a column's value from the currently highlighted row in gridview in the calling form?

View 4 Replies

Calling Outlook Contacts Form From .net - A Dialog Is Open Close It?

Jan 24, 2012

I have made a little programme where the user can put in a name to search for a contact.The matches then fill a Datagrid and the user can then choose the one they want and the programm then opens the contact form (from outlook client)The Contact form opens ok, and it brings up the correct contact. If the user then selects the option to "Email" from that from I then get the error message"A Dialog is open" etc...

My code is as follows

Sub GetContact()
Dim objOutlook As Outlook.Application
Dim objNS As Outlook.NameSpace

[code]....

It seems to be due to Outlook being open or opening?

View 2 Replies

DataGridView's RowValidating Event Fires Differently When Closing A Modal Vs NonModal Form

Mar 24, 2011

Based on our tests primarily done in VB.NET in VS2010 it seems that when you close a WinForm the "RowValidating" event of the DataGridView on that form behaves differently depending on whether the form is MODAL or NON-MODAL. What we did was open the form (MODAL and NONMODAL) and changed a value of a cell and then immediately clicked the "X" to close the form. It looks like the "RowValidating" event DOESN'T fire if the grid is on a MODAL form but it DOES fire when the grid is on a NON-MODAL form. We can't figure out why that is... Is this a known bug in .NET?

[Code]...

View 3 Replies

VS 2008 Timers - Display Form For 5 Seconds On Form_load Event

Dec 14, 2009

I want to display form1 for 5 seconds on my form_load event, after 5 seconds i want it to close , im not sure how to do it with a timer,

View 2 Replies

Hide The Form Onload?

Mar 8, 2011

i want my form hide whenever its running. I'm doing autoback up.

me.visible = false

is not working.

View 5 Replies

Setting Focus To Form Onload?

Sep 18, 2009

i designed a form in which some records are loading in a datagrid. Here i want to focus the form at form loading. here when i run the pgm it focusing on the grid only. how can i do this?

View 11 Replies

Change Form Focus In The Main Load Event?

Jul 7, 2009

I have an application with a main menu.

File , Menu B, Menu C ....
-1
-ServiceMenu

When the user run the application I would like to show the File menu->ServiceMenu form and the main menu should be allways on the background. I try the following: From the main menu load events call the ServiceMenu routin.

Private Sub ServiceMenu()
Dim szt As New sztetelek
Me.AddOwnedForm(szt)

[code]....

My problem the following the new ServiceMenu (szt form) show in the right position but cannot get focus. My user have to click on it to the form gets the focus however if the user click the File-ServiceMenu this forms works well and get the focus.I think the main menu get back the focus (If i press the ALT the File menu dropdown .... )

View 6 Replies

Close A Modal Form From Who Initiated Modal One?

Feb 25, 2011

I have a parent form (form1), which is calling a second form (form2) as modal.[code]...

No form2 is modal. Closing this form2 from the form itself is clear.But how can I close the form via myform2.close from form1 via an event handler?

View 6 Replies

VS 2010 Does Form.showDialog() Require A Form.dispose

Jan 5, 2012

Quote:

Originally Posted by kaliman79912

Quick note: Close does not dispose of the form if it was displayed using .ShowDialog, but I guess this is not the case.

I did not want to hijack the other thread [URL] but would like to have this clarified for me.

View 5 Replies

Use A Delegate To Update Text Of Main Form From DoWork Event Of BackgoundWorker?

Mar 26, 2010

How would you create and use a delegate to update the text of the main form from the DoWork event of a backgoundWorker?

View 4 Replies

Calling Click Event Of Button Of Form On Panel?

May 22, 2012

I have one tabstrip control having two tabs. On one tab i have Panel control where i have showed another form and this other form have one button "Submit". On other tab i have some controls and one button "OK". Now on clicking "OK" button i have to call the click event of "Submit" button of the form on panel on other tab. All this is in windows application in vb.net.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved