473,387 Members | 1,590 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Modal dialog from .cs file

I have a class that based on a timer will pop up a dialog based on a
lasped amount of time.

The problem is that in the timer elapsed event I create and use
ShowDialog to show the timeout form:
frmTimeout dlg = new frmTimeout();
dlg.ShowDialog(dlgOwner); <-- dlgOwner if the IWin32Window of the
window in focus
When the dialog opens, it is not modal. I've tried passing the
IWin32Window of the dlg in focus, just using ShowDialog() but no luck.

Is there a way to open this dialog from code and have it truely modal?
(I don't want to use the AlwaysOnTop flag).

thanks,

Jamie
Nov 17 '05 #1
2 2633
Jamie,

It works for me. Can you post an example of where calling ShowDialog
doesn't make the form modal?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"jamie" <no@way.com> wrote in message
news:CM*******************@news20.bellglobal.com.. .
I have a class that based on a timer will pop up a dialog based on a lasped
amount of time.

The problem is that in the timer elapsed event I create and use ShowDialog
to show the timeout form:
frmTimeout dlg = new frmTimeout();
dlg.ShowDialog(dlgOwner); <-- dlgOwner if the IWin32Window of the window
in focus
When the dialog opens, it is not modal. I've tried passing the
IWin32Window of the dlg in focus, just using ShowDialog() but no luck.

Is there a way to open this dialog from code and have it truely modal?
(I don't want to use the AlwaysOnTop flag).

thanks,

Jamie

Nov 17 '05 #2
Nicholas Paldino [.NET/C# MVP] wrote:
Jamie,

It works for me. Can you post an example of where calling ShowDialog
doesn't make the form modal?


Hi Nicholas,

I'll post an example and give a little more detail.

The C# code that I'm using is a Class Library and used as a COM Dll from
a VB6 application.

The VB6 application opens a dialog from the C# dll which is modal (this
works as expected). This dialog gets the instance of a singleton class
which contains a timer to track inactivity (dialogs will reset this
timer on mouse_move).

When the timer elapses I want to popup a dialog modally to the VB6
application and the modal C# dialog that is already opened.

Here is my timer elapsed code:

private void timer_Elapsed(object sender, ElapsedEventArgs e)
{
this.Stop(); // this stops the timer
frmTimeout dlg = new frmTimeout();
dlg.ShowDialog();
}

I've also tried passing the IWin32Window of the opened C# dialog and
using that for the parent in ShowDialog.

This singleton class sits in a cs file that does not contain a UI.

Thanks for your help,

Jamie
Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: martin de vroom | last post by:
Hi, I have a web page that opens a modal dialog (client side) in the following manner onclick="window.showModalDialog('/dialog.asp',null,'dialogHeight: 200px; dialogWidth: 400px; dialogTop:...
2
by: Gilles T. | last post by:
Hi, How I can refresh a modal dialog in asp.net? I open a modal dialog in first with a dropdownlist. To add a element in my dropdownlist (table), I open a second modal dialog to ask element and...
2
by: Joe | last post by:
Is there a way to enable scrolling in a modal dialog box even if the call to open the modal has "scroll:no"? I am looking to dynamically size the modal dialog box for starters and if the modal is...
3
by: Andrew | last post by:
I get a Null Reference Exception if I close a non-modal dialog (that is, a form opened with Show()) when a selection is made from a ComboBox. The error message refers to Unsafe Native Methods, but...
3
by: Earl Teigrob | last post by:
Can a Modal Dialog Box do forms ASP.NET forms validation from within the Modal Box? I want to pop up a dialog box to the user and have it do its own post backs with validation checking and then...
2
by: Guadala Harry | last post by:
I have a frameset aspx page that enables users to upload photos. One frame/page shows a thumbnail list of prevously-uploaded images, and the other frame/page includes the controls that enable...
10
by: Guadala Harry | last post by:
I have a modal dialog that currently does all of the following except item 4. 1. lets users select a graphic from a list of thumbnails (and when selected, displays the full-size image in a...
2
by: sthrudel | last post by:
Hi! I'm working on a web application in Asp.net and what I would like to have is a cross borwser modal dialog which accepts user's input. I would like to catch what the user clicked on the...
1
by: dhanashivam | last post by:
Hi All, I have developed a VC+ dll file which provides a product key for my msi setup file. This VC++ dll work fine together with my setup file. but, my problem is, i have given a message box...
11
by: VK | last post by:
In the continuation of the discussion at "Making Site Opaque -- This Strategy Feasible?" and my comment at http://groups.google.com/group/comp.lang.javascript/msg/b515a4408680e8e2 I have...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.