I have built what I think should be a dialog box. It contains 4 tabbed panes for generating a range of colors. Each
tabbed pane consists of a panel with all the widgets on them including the OK and Cancel buttons. These buttons have to
be on the panels themselves so that they can create the color range from the current settings on the panel and return
the result via a delegate to the main dialog form.
The problem I have is that the OK button needs to do the extra work before exiting. So, is there a way that I can force
the return result from the dialog box to DialogResult.Ok (or Cancel) before exiting. I.e. can I just exit or return from
the dialog form with these return codes?
Or, can I still set the OK and cancel buttons on all the panels with (okBtn.DialogRe sult = DialogResult.OK ) and still do
an OnClick callback for the button?
Thanks,
Steve 2 17740
"steve bull" <bu****@comcast .net> wrote in message
news:s2******** *************** *********@4ax.c om... I have built what I think should be a dialog box. It contains 4 tabbed panes for generating a range of colors. Each tabbed pane consists of a panel with all the widgets on them including the OK and Cancel buttons. These buttons have to be on the panels themselves so that they can create the color range from the current settings on the panel and return the result via a delegate to the main dialog form.
The problem I have is that the OK button needs to do the extra work before exiting. So, is there a way that I can force the return result from the dialog box to DialogResult.Ok (or Cancel) before exiting. I.e. can I just exit or return from the dialog form with these return codes?
Or, can I still set the OK and cancel buttons on all the panels with (okBtn.DialogRe sult = DialogResult.OK ) and still do an OnClick callback for the button?
If I understand you correctly, you want the function that is called when the
OK button is clicked to do some processing before it closes the dialog box?
If so, remove the okBtn.DialogRes ult entry from the form, and manually add
it to the end of the eventhandler - something like this:
private void btnOK_Click(obj ect sender, System.EventArg s e)
{
DoProcessing(); //This function does the extra stuff you want to do
DialogResult = DialogResult.OK ;
Dispose();
}
yes, thanks, that works. The problem was that I didn't want C# to do the handling automatically and I wasn't sure how to
get the calling form to pick up the return value DialogResult.OK .
steve
On Fri, 13 May 2005 22:54:26 -0700, "BrianGlaca in" <bg******@yahoo .com> wrote: "steve bull" <bu****@comcast .net> wrote in message news:s2******* *************** **********@4ax. com... I have built what I think should be a dialog box. It contains 4 tabbed panes for generating a range of colors. Each tabbed pane consists of a panel with all the widgets on them including the OK and Cancel buttons. These buttons have to be on the panels themselves so that they can create the color range from the current settings on the panel and return the result via a delegate to the main dialog form.
The problem I have is that the OK button needs to do the extra work before exiting. So, is there a way that I can force the return result from the dialog box to DialogResult.Ok (or Cancel) before exiting. I.e. can I just exit or return from the dialog form with these return codes?
Or, can I still set the OK and cancel buttons on all the panels with (okBtn.DialogRe sult = DialogResult.OK ) and still do an OnClick callback for the button?
If I understand you correctly, you want the function that is called when the OK button is clicked to do some processing before it closes the dialog box? If so, remove the okBtn.DialogRes ult entry from the form, and manually add it to the end of the eventhandler - something like this:
private void btnOK_Click(obj ect sender, System.EventArg s e) { DoProcessing(); //This function does the extra stuff you want to do DialogResult = DialogResult.OK ; Dispose(); } This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jim Heavey |
last post by:
Hello
If I have created a form which will be used as a dialog box, how do I get
the results passed pack from the dialog box?
I tried this
DialogResult rslt = frm.ShowDialog();
I do not get any compile error, but when I try to use the "rslt" I thought
|
by: bryanhobson |
last post by:
I'm fairly new to c#, and I am just trying to work out how a
'properties' dialog works.
Currently in my code, I have an object represented by the class 'Dog'.
The dog object has several properties.
I have added a new windows form, class 'DogProperties'. I'm attempting
to use this to allow the user to edit the properties of an instance of
'Dog'.
|
by: ronenk |
last post by:
I have this code to load an authentication form once my app is loaded.
I want the authentication form to be closed if a user is authenticated
successfully and to give the option to close app on his decision.
private void MainForm_Activated(object sender, EventArgs e)
{
AuthFrm StartUpfrm = new AuthFrm();
if (StartUpfrm.ShowDialog() == DialogResult.OK)
|
by: Dusty Hackney |
last post by:
Hello,
I am programming in Visual Basic .NET. I have seen examples of creating a
login form to use for users to type in their username and password, but I
want to accomplish the same thing with a pop-up dialog box instead. How can
I make my program bring up a pop-up login dialog box for a user to type in
username and password?
Thanks,
Dusty
|
by: kgerritsen |
last post by:
I am building an application that will receive input from a barcode
scanner. The barcode scanner is configured to append to the front
value a single character and hyphen that identify the barcode
standard, then the value in the barcode, terminated by a return. The
barcode scanner appears to the operating system as a USB keyboard.
I am loading the barcode value into a textbox both on my Form1 and on
a dialog box where the user has to...
| |
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 boxes (please see
associated source code below):
1) Win32 API with context ("btnWin32WithContext_Click")
2) .NET Framework with context ("btnFrameworkWithContext_Click")
3) Win32 API withOUT context ("btnWin32WithOUTContext_Click")
|
by: =?Utf-8?B?RGF2ZSBHcmVnb3J5?= |
last post by:
I have a dialog box that I have several groups of radio buttons on for the
selection of different operations. These are in addition to the "OK" and
"Cancel" buttons. I have no trouble getting the info back on the buttons but
I have been unable to get info back on the selected radiobuttons. I have
tried several different methods. I have determined that my global variables
do not get passed to the Dialog Box even though it is called by...
|
by: dgleeson3 |
last post by:
Hello all
I have used the LoginForm1 class in a Visual studio 2005 VB
application.
Its the standard Username, Pasword request for user input.
I was hoping to use property procedures to get back the user input in
the two boxes but its not working out.
|
by: Tony Johansson |
last post by:
Hello!
I know there exist some commonDialogs in .NET
such as SaveFileDialog,OpenFileDialog printDialog and so.
I just want to know if a dialog is the same as a form ?
I mean when these dialogs was created it uses
the form as the base for creating these dialog.
When I create a window form application I use form to create the window.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |