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


ADVERTISEMENT

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

Pass A Value Into A Modal Form?

Jan 29, 2012

I'm trying to pass a value from the main form, "form1" into "form2". I'm opening "form2" as a modal dialog from this line of code:

form2.ShowDialog()

View 4 Replies

Progressbar In Another Modal Form

Jun 10, 2011

I have a form where I generate a report on some button click. I need to show another Form in Modal Form, And Place Progress bar on that and Increment the status, from calling form so that when progress bar is running user cannot close the form (where I placed button for showing report). To calculate progressbar's percentage is in the form where button to show report is.

View 4 Replies

How To Temporarily Hide A Modal Form

Mar 29, 2009

I've created an Excel COM add-in that has several forms. The application has the following forms:

FormA (Modeless): Excel.Application is parent
FormB (Modal): FormA is parent
FormC (Modal): FormB is parent

[code].....

View 3 Replies

IDE :: Controlling A Modal Form From A Module?

Nov 17, 2009

I have a situation where I need to display a Modal Window from a vb.net module and feed the contents to that modal form from the module.I am showing the form , feeding data to it from a class module and trapping the events in it using a timer control from the module.It works fine with Show() method but it doesn't with ShowDialog().If I used ShowDialog() then I was not able to continue with the code followed by it and not able to update any contents in the modal form.

I am using VS2003 version.Is there any workaround to this?

View 1 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

Switch Form To Modal After It Is Opened?

Sep 20, 2010

If I have a form open already that is not modal, can I turn it modal by the click of a button on that form.

View 1 Replies

Update Any Contents In The Modal Form?

Nov 17, 2009

I have a situation where I need to display a Modal Window from a vb.net module and feed the contents to that modal form from the module.I am showing the form , feeding data to it from a class module and trapping the events in it using a timer control from the module.It works fine with Show() method but it doesn't with ShowDialog().If I used ShowDialog() then I was not able to continue with the code followed by it and not able to update any contents in the modal form.

View 4 Replies

Use Binding To Display A Modal Form?

Apr 1, 2010

As part of my design for a re-write of some vb6 code, i've got some business rules that check the data being entered. These rules run on the business layer, but if they find any data that is incorrect, they need to display a modal form showing the 'violation' (or could be a warning, a question or some information).

So what i'm after doing is to somehow display a modal form in my presentation layer triggered by my business layer.

The only solution i've come up with is to raise an event to get the modal form displayed, catch the event in the presentation layer and display the form (all items on the form would be bound and so would display the correct information). Problems with this is that i would then have to put the code to sleep in the business layer until i got a responce from the presentation layer.

View 1 Replies

VS 2008 Non-modal Form To Act Modally?

Aug 17, 2011

All of my forms are MDI children. I have one form that is collecting input parameters for a report. One of the parameters needs to come from another form. For the life of me, I can't get it to work.

[Code]...

I have to message box code just to verify the selection. glbPart is just a hand off parameter to tell the frmVendorList code to come back to this form rather than where it was origianlly programmed to go.I tried a do until glbVendor <> "", but that put me into a death loop and I never got to select a vendor from the vendor list form. Obviously, the easiest would be if I could make frmVendorList Modal, but I can't see how to do that once it's been created modally.

View 26 Replies

VS 2008 Reload Modal Form

May 18, 2011

I have a form with a browser inside. When loading this form I set the browser.navigate to a url.Now to display this form I used the: form. ShowDialog()to have the form modal (which is what I want).But now when I close this form and reopen it, the browser doesn't refresh (the navigate doesn't start)this is beacuse closing a Showdialog() form doesn't unload it from the memory. To empty the memory I used the.[code]It closes and when reopened it reload the page, but it's not modal anymore and also closing the main form doesn't close this form.So what I would like is to have the form with the browser modal, but every time I load it, it should navigate to the url set.

View 8 Replies

VS 2010 How To Return A Value From A Modal Form

Jun 4, 2010

I have a parent form that can open a modal form which contains a populated listbox. In the parent form, I can use DialogResult to detect which item in the listbox the user chose in the modal form. But I also want the modal form to return a string that was generated in the modal form.

EDIT: Ok, I suppose some code is necessary? In I would like to return the "longPath" string variable(near bottom of second pic) to form1(first pic).

View 6 Replies

C# - Make A Form Modal In Windows Forms?

Mar 23, 2010

I'm trying to create a child form that helps the user to enter data for a field in the parent form. I want this child form to be modal, but I don't know what I need to do to make this form modal. Perhaps there's a different type of item I need to use; if so,

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

Passing Variable From Windows Form To Modal?

Mar 28, 2012

Windows Forms, VB. I have searched the web for the correct answer to this and no dice. Either they are missing on what I am trying to accomplish or are in CSHARP making it harder for me to see what they are doing. I have a need to pass a record Id from the main windows form into a modal Dialog Load Event.. I have tried throwing a with param in but then I have to change the Load event params and vb flags it.. I am trying to pass the value of _CurrentProp which is an integer into the dialog. This is the dialog constructor and the load event inside that dialog..

[code]...

I am going to simply assign the value to a global variable inside the PropertySettings Class but everything I try seems to fail in one way or another...

View 1 Replies

VS 2008 Modal Form Closing Unexpectedly

Dec 18, 2009

I have a modal form that does double duty.When a user wants to add a new object to a database, I open the form blank and they fill it out. When the form closes, all of the data is passed back to my main form and is used to create the new object in the database.When a user wants to edit an existing object, I open the form and pre-populate all of the fields with the object's data.I'm running checks on the form as they edit the fields, only enabling the "OK" button (which will update the database) if the form has actually been changed. If they make a change and then undo it, the "OK" button is reset to Enabled = False.At the bottom of the form are a ComboBox, two buttons and a ListBox. The intent is to allow the user to select an item from the ComboBox and "Add" ("Add" button) to the ListBox, or select an item in the ListBox and "Remove" ("Remove" button) it FROM the ListBox.

This function works fine when the form is loaded blank.When the form is loaded with data, however, (and in the testing I've done, the ListBox has no items in it to start, which is valid), adding an item from the ComboBox to the ListBox causes the Modal form to close with a DialogResult of Cancel.I've tried to trace the source of this issue, but stepping through each line in debug mode gives me no clue as to why this is happening.I COULD remove all of the checks and update the form each time the user presses "OK" (in the case of no changes, the database data would be overwritten with the same data), but that seems kludgy and less elegant. Plus, I'd like this logic to work.

View 11 Replies

VS 2010 How To Keep A Modal Form Displayed Under A Messagebox

Jun 5, 2010

I have a parent form, which can lanch a dialog box. A wrong selection in the box launches a message box with an error message. When the message box pops up, the dialog box disappears, so the messagebox is sitting on top of the parent form.Once the user clicks "OK" in the messagebox, the box disappears, and only the parent form remains.How do I make it so that the dialog box remains when the messagebox is displayed? And also, I want the dialog box to remain when the user closes the message box. The user should have the option to make the right selection in the dialogbox once the messagebox disappears.I tried to hunt for a property for the dialog box to achieve this, but couldn't find any.

Here is the code in the parent form to lauch the dialog box, and to also launch the messagebox, when the user has made a selection in the dialogbox:[code]Am I having this problem because all the code to launch the dialog and message boxes reside in the parent form? If I put the code to launch the messagebox in the dialog box, would that make the dialog box persistent when the messagebox is launched? I am putting all the code in the parent form because it can process the DialogResult.

View 4 Replies

When Modal Form Goes Bad And Lets Its Owner Be Activated

Feb 24, 2012

I am currently converting a 90s VB6 application to VB.NET. While testing I came across something curious.A Modal form by definition will prevent users accessing any other form in the application.This I discovered is not always true as I have a Modal form displayed which allowed me to access its owner form's Menu.Searching MSDN I could find no mention of this feature. So I thought I would share it:Click Button 1 on Form2 and Form1 comes back to life!

View 12 Replies

VS 2005 Child Form Remain Enabled While Modal Form Displayed?

Oct 28, 2010

I have a VB. Net App where I want the user to open a modeless form which contains reference information about items in a select box. If the user double clicks the item selected in the list box a modal form is opened to edit the item.I want the previously opened reference form to remain active/enabled, that is, I want the user to be able to click on it, move it, etc.I was able to get the form to at least show up on the task bar by setting it's "ShowInTaskBar" property to true, however, when it comes to the front the user can still not move it to the side to view all of the Edit Forms information.

View 7 Replies

Form Is Loaded Inside A Modal Dialogue And Within That A Iframe

Sep 5, 2011

I'm a little stuck on what to do! I have a special form that allows my customers to request a quote for a specific product (defined by PID in url) The form is loaded inside a modal dialogue and within that a Iframe. The Iframe's src value is set from the onclick event of ahref on the product pages eg; [code]

View 1 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

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

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

Asp.net - Setting Control Text In Parent Form From Modal Popup

Mar 28, 2012

I have a problem I am trying to set the parent textbox from the modal popup.

Although I found the control from the modal popup with the below code
DirectCast(Parent.Page.Form.FindControl("ContentPlaceHolder1").FindControl("myAccordion").FindControl("txtTo"), TextBox).Text = str

This is being called on button click when the user has finished selecting from the Checkboxlist.

When the parent page is shown again though the textbox is empty.

The scenario of my user control is that a user is to select from a checkbox list which is a list of emails.

When done has been clicked then it is required that the selected emails be forwarded to the parent webpage.

Then the To Textbox in this case will be filled with the emails that the user has selected.

View 1 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

Windows - Drag And Drop - Modal Form Blocks Everything Until It Is Closed

Jun 10, 2011

I am implementing Drag & Drop in windows application. I have Main Form (Has a toolbar with Search, Open, Print etc) - MdiContainer On Search - Open a child - Search form. Drag and Drop a file to a Grid on this search form. In DragDrop event of the Grid - Call a Modal form. I am having trouble here.

[Code]...

View 1 Replies

Keep Form On Top Of Another Form In Modal Fashion, But Continue Execution?

Apr 18, 2012

I have a form in a vb.net windows form application called PolicyRefreshStatus.vb that has a ProgressBar control on it. From the main form called EditPolicy.vb I need to show PolicyRefreshStatus.vb over top of EditPolicy.vb - but the way things are wired I'm controlling the the ProgressBar and it's steps from logic inside EditPolicy.vbIf I display the PolicyRefreshStatus.vb bar using the .show() method things work fine.The problem is if the user clicks back on the main form then PolicyRefreshStatus.vb losses focus. If I show PolicyRefreshStatus.vb as a modal form using .ShowDialog() then execution halts in EditPolicy.vb after the .ShowDialog() statement.

so for example in the code:
mPolicyRefreshStatus = New PolicyRefreshStatus
mPolicyRefreshStatus.pbMax = mPolicy.ClaimsUpdateMax

[code]....

View 2 Replies

Passing Values From Modal Form To Parent Form?

Aug 11, 2011

I am trying to pass information to parent form from modal form in vb.net winforms application.

1.) I created a copy of a form and displayed it using following code.

dim f=new frmParent()
f.show()

2.) Depending on conditions a button on frmParent opens a modal child form and asks for some informations. I used following code for that:

dim f = new ChildForm()
f.showDialog()

Both code works fine. When user press saves in child form i need to close childForm and use the user types values in parent form. I know how to close the childform but not sure how to pass info from childform to parent form.

View 1 Replies







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