473,509 Members | 2,457 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

What can modal forms return?

I want to show a form Modally and return a value.

Checking the documentation it looks like I need to return one of the
DialogResults.

Is that true or can I return any value?

Thinking I must return one of the DialogResult enumerations I did the
following.

Is that the way people do it?

Thanks

Public Enum PrintQuery

PrintThisPage = DialogResult.Yes

SkipThisPage = DialogResult.No

StopPrinting = DialogResult.Abort

CancelEntireDocument = DialogResult.Cancel

End Enum

Private Sub btnStopPrinting_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnStopPrinting.Click

DialogResult = PrintQuery.StopPrinting

End Sub


Nov 20 '05 #1
2 1149
Hi,

ShowDialog only returns a dialogresult. I return a dialogresult.ok if
the data on the form is valid and the user doesn't press the cancel
button. You can pass the data back to the original form through a forms
property.

Ken
---------------------

"Just Me" <ne********@a-znet.com> wrote in message
news:#9**************@TK2MSFTNGP09.phx.gbl:
I want to show a form Modally and return a value.

Checking the documentation it looks like I need to return one of the
DialogResults.

Is that true or can I return any value?

Thinking I must return one of the DialogResult enumerations I did the
following.

Is that the way people do it?

Thanks

Public Enum PrintQuery

PrintThisPage = DialogResult.Yes

SkipThisPage = DialogResult.No

StopPrinting = DialogResult.Abort

CancelEntireDocument = DialogResult.Cancel

End Enum

Private Sub btnStopPrinting_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnStopPrinting.Click

DialogResult = PrintQuery.StopPrinting

End Sub


--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.0 - Release Date: 6/12/2004
Nov 20 '05 #2
Thanks for the info.
"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:eJ*************@TK2MSFTNGP11.phx.gbl...
Hi,

ShowDialog only returns a dialogresult. I return a dialogresult.ok if
the data on the form is valid and the user doesn't press the cancel
button. You can pass the data back to the original form through a forms
property.

Ken
---------------------

"Just Me" <ne********@a-znet.com> wrote in message
news:#9**************@TK2MSFTNGP09.phx.gbl:
I want to show a form Modally and return a value.

Checking the documentation it looks like I need to return one of the
DialogResults.

Is that true or can I return any value?

Thinking I must return one of the DialogResult enumerations I did the
following.

Is that the way people do it?

Thanks

Public Enum PrintQuery

PrintThisPage = DialogResult.Yes

SkipThisPage = DialogResult.No

StopPrinting = DialogResult.Abort

CancelEntireDocument = DialogResult.Cancel

End Enum

Private Sub btnStopPrinting_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnStopPrinting.Click

DialogResult = PrintQuery.StopPrinting

End Sub


--
Outgoing mail is certified Virus Free.
Checked by AVG Anti-Virus (http://www.grisoft.com).
Version: 7.0.230 / Virus Database: 263.3.0 - Release Date: 6/12/2004

Nov 20 '05 #3

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

Similar topics

3
8127
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...
2
2544
by: cassidyc | last post by:
Hi, I was wondering if anyone has come accross this issue? And if they have any solutions I have that can create new copies of itself Form1 as = new form1(); af.show(); This form can also...
8
2703
by: Stephen Rice | last post by:
Hi, I have a periodic problem which I am having a real time trying to sort. Background: An MDI VB app with a DB on SQL 2000. I have wrapped all the DB access into an object which spawns a...
1
2713
by: Jeremy | last post by:
Hello, I'm thinking this may be an easy one but I am getting frustrated. How can I detect if a process is showing a modal dialog. Like "Are you sure you want to exit?", or an error message...
4
2741
by: Greg Smith | last post by:
I have a user who likes to keep my application minimized. He wants to have a pop up of some sort come up to tell him he needs to return to the application to take action. I have used both...
2
2630
by: Mike | last post by:
Hi, I'm having a problem with modal forms on windows. I've written a very short test program, with a main window and a form called from the main window. The form is set to modal with...
2
4490
by: =?Utf-8?B?TmF0aGFuIFdpZWdtYW4=?= | last post by:
Hi, I am wondering why the .NET Framework is quite different from Win32 API when it comes to displaying system modal message boxes. Consider the four following types of system modal message...
4
2878
by: Johnny Jörgensen | last post by:
In my current project I've got some DataGridViews containing multiple hidden columns. For some reason 8 of the 10 grids I've got on my form has suddenly started showing 1 of the hidden columns...
4
4530
by: =?Utf-8?B?Z2luYWNyZXNzZQ==?= | last post by:
I am trying to close/dispose multiple instances of a form but because they are modal and hidden, they do not show up in My.Application.OpenForms. They must be modal, so making them modeless is not...
1
3546
by: Mohit | last post by:
Hi all, I am working on a windows based client server application with multiple forms. All forms are having custom title bars with no default bars. There is one main form. Some forms are opened up...
0
7233
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
7342
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,...
1
7067
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5650
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5060
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4729
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3215
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3201
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1570
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.