473,396 Members | 2,013 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,396 software developers and data experts.

Beginner Dialog Question

I have a dialog box that asks for user input in 3 textboxes and has 2
buttons: Ok & Cancel.

If the user input is validated, the box should return
DialogResult.OK. If the user input isn't validated, it should display
a message and return nothing at all, keeping the dialog box visible
until the input is validated or the user presses the cancel button.

The problem is that I can't choose between "return DialogResult.OK" or
just "return" (to keep the dialog visible) because they're different
return types.

I can think of a few ways to work around it, including validating the
input in the main form and re-displaying the dialog box if it fails,
but I'm wondering what the standard method of handling something like
this?

Nov 6 '07 #1
2 1974
On 6 nov, 09:57, markl...@gmail.com wrote:
I have a dialog box that asks for user input in 3 textboxes and has 2
buttons: Ok & Cancel.

If the user input is validated, the box should return
DialogResult.OK. If the user input isn't validated, it should display
a message and return nothing at all, keeping the dialog box visible
until the input is validated or the user presses the cancel button.

The problem is that I can't choose between "return DialogResult.OK" or
just "return" (to keep the dialog visible) because they're different
return types.

I can think of a few ways to work around it, including validating the
input in the main form and re-displaying the dialog box if it fails,
but I'm wondering what the standard method of handling something like
this?
In my experience, everyone has something to complain about for all
dialogs.

But in general, dialogs within an application should all behave the
same way.

My recommendation is to 1) choose the behaviour that fits in with the
rest of the dialogs in the application and then 2) get user feedback
from a prototype and update the behaviour accordingly.

Nov 6 '07 #2
ma******@gmail.com wrote:
I have a dialog box that asks for user input in 3 textboxes and has 2
buttons: Ok & Cancel.

If the user input is validated, the box should return
DialogResult.OK. If the user input isn't validated, it should display
a message and return nothing at all, keeping the dialog box visible
until the input is validated or the user presses the cancel button.

The problem is that I can't choose between "return DialogResult.OK" or
just "return" (to keep the dialog visible) because they're different
return types.
You can use DialogResult.None for exactly that -- setting it means that
it will remain visible.
I can think of a few ways to work around it, including validating the
input in the main form and re-displaying the dialog box if it fails,
but I'm wondering what the standard method of handling something like
this?
IMO there are a number of valid reasons to keep your validation inside
the dialog, provided it has all the information it needs to accurately
validate the input.
Chris.
Nov 6 '07 #3

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

Similar topics

3
by: Art | last post by:
NEWBIE ALERT! Esteemed List Participants and Lurkers: (System: P-II 350, 192 meg, Win98 SE, Python 2.2.3, wxPythonWIN32-2.4.1.2-Py22.exe) I'm having a lot of fun getting started with Python...
23
by: hedylogus | last post by:
I've just begun learning C++ and I'm trying to write a program to shuffle a deck of cards. I've succeeded....for the most part....but every now and then rand() produces duplicate random numbers...
1
by: VM | last post by:
I'm trying to find the code that's executed when a button in a dialog is pushed. In my AppMaster.rc file, I have a Dialog folder with IDD_DIALOGBAR1 and IDD_DIALOGBAR2 . When I click on...
5
by: gilgames | last post by:
I am new in VB.Net, I need some help. I want to resize my dialogs dynamically (so that a dialog made for 1280x1024 screens shows properly on 800x640 screen. I make the calculation in the Handles...
3
by: William Foster | last post by:
Good evening all, Microsoft is really starting to annoy me as a new user. I am trying to convert my code from VBA (A very user friendly laguage with generally good help files) to Visual Studio...
5
by: charles | last post by:
I have a question about the file Open dialog box. I would like to be able to make the dialog box bigger by selecting the bottom right-hand corner and dragging/expanding the box. I am told by...
2
by: Glen | last post by:
Hello, I've written a script in python and put together a simple QFrame with a QTextBrowser with Designer. I've translated the C++ into python using puic4. The .py file is called outputWin.py. ...
3
by: deciacco | last post by:
I'm trying to write a label printing SDI app with a small preview on the main form itself. Every time I run the InvalidatePreview event on the preview control to redraw the preview I get the...
10
by: Roman Zeilinger | last post by:
Hi I have a beginner question concerning fscanf. First I had a text file which just contained some hex numbers: 0C100012 0C100012 ....
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:
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
tracyyun
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...
0
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,...

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.