Click here to Skip to main content
15,887,776 members
Home / Discussions / C#
   

C#

 
GeneralRe: Static Question Pin
Roland Bär1-Jul-03 4:58
Roland Bär1-Jul-03 4:58 
Generalhelp!! Pin
jphuphilly1-Jul-03 2:41
jphuphilly1-Jul-03 2:41 
GeneralRe: help!! Pin
leppie1-Jul-03 13:08
leppie1-Jul-03 13:08 
GeneralGetObjectsForNativeVariants Pin
vikramlinux1-Jul-03 1:23
vikramlinux1-Jul-03 1:23 
QuestionHow do I create a Dialog ? Pin
JeffSayHi1-Jul-03 1:20
JeffSayHi1-Jul-03 1:20 
AnswerRe: How do I create a Dialog ? Pin
Manster1-Jul-03 4:29
Manster1-Jul-03 4:29 
GeneralRe: How do I create a Dialog ? Pin
JeffSayHi1-Jul-03 14:50
JeffSayHi1-Jul-03 14:50 
AnswerRe: How do I create a Dialog ? Pin
LongRange.Shooter1-Jul-03 11:03
LongRange.Shooter1-Jul-03 11:03 
I have constructed many dialogs in my apps where I would do the following:

Build the dialog as a form within the project
Fill out the dialog box with everything I wanted to collect form the user.
Expose those items with public accessors
Add an Okay button which sets DialogResult = DialogResult.OK; etc.

(example: AskForFiles has englishDict frenchDict and germanDict exposed as public accessors. The user can click buttons to browse for the dictionary files in the dialog)

In my main program I then add this code:

C#
AskForFiles newDialog = new AskForFiles();
if (some file names already defined)
{
   newDialog.englishDict = value;
   newDialog.frenchDict  = value;
   newDialog.germanDict  = value;
}
newDialog.ShowDialog(this);
if (newDialog.DialogResults == DialogResults.OK)
   newFileName1 = newDialog.englishDict;
        ...


This way you can issue a dialog, get the results from that dialog, with OK indicating they set all the values and Cancel indicating they changed their minds. You need to make sure you never issue a return without a this.Close() and setting this.DialogResult.

I also make the form properties for Abort and Accept set to the corresponding buttons on the form so any key input creates the desired results as well. For example: the user enters all dictionary names and hits enter is the same as clicking the Okay button. the user hits Esc is the same as clicking the Cancel button. etc...


_____________________________________________
The world is a dangerous place.
Not because of those that do evil,
    but because of those who look on and do nothing.

AnswerRe: How do I create a Dialog ? Pin
LongRange.Shooter1-Jul-03 11:07
LongRange.Shooter1-Jul-03 11:07 
GeneralNew to C# Pin
parths1-Jul-03 0:09
parths1-Jul-03 0:09 
GeneralRe: New to C# Pin
Michael P Butler1-Jul-03 1:04
Michael P Butler1-Jul-03 1:04 
GeneralRe: New to C# Pin
james-cxx1-Jul-03 5:16
james-cxx1-Jul-03 5:16 
GeneralRe: New to C# Pin
parths1-Jul-03 16:23
parths1-Jul-03 16:23 
Generalstrange characters? how can i remove Pin
Asim N.30-Jun-03 22:50
Asim N.30-Jun-03 22:50 
GeneralRe: strange characters? how can i remove Pin
Philip Fitzsimons1-Jul-03 1:40
Philip Fitzsimons1-Jul-03 1:40 
GeneralRe: strange characters? how can i remove Pin
Asim N.2-Jul-03 22:50
Asim N.2-Jul-03 22:50 
GeneralHelp With Reading RSA Private Key From File (C#) Pin
yccheok30-Jun-03 21:56
yccheok30-Jun-03 21:56 
Generalreading a minimized form/window into a bitmap?how do i read a minimized form/window into a bitmap. Pin
peenu30-Jun-03 20:42
peenu30-Jun-03 20:42 
QuestionHow to upload a web-application? Pin
puppiesLover30-Jun-03 20:22
puppiesLover30-Jun-03 20:22 
QuestionConstrain form to horizontal resize only? Pin
james-cxx30-Jun-03 19:27
james-cxx30-Jun-03 19:27 
AnswerRe: Constrain form to horizontal resize only? Pin
Jim Stewart30-Jun-03 19:59
Jim Stewart30-Jun-03 19:59 
AnswerRe: Constrain form to horizontal resize only? Pin
peenu30-Jun-03 21:46
peenu30-Jun-03 21:46 
GeneralRe: Constrain form to horizontal resize only? Pin
james-cxx1-Jul-03 5:12
james-cxx1-Jul-03 5:12 
GeneralGDI Tip of the Day Pin
leppie30-Jun-03 18:14
leppie30-Jun-03 18:14 
GeneralRe: GDI Tip of the Day Pin
Oleksandr Kucherenko30-Jun-03 21:44
Oleksandr Kucherenko30-Jun-03 21:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.