Click here to Skip to main content
15,921,660 members
Home / Discussions / C#
   

C#

 
QuestionHow to break from an If Statement Pin
vct30-Aug-06 18:32
vct30-Aug-06 18:32 
AnswerRe: How to break from an If Statement Pin
Guffa30-Aug-06 19:09
Guffa30-Aug-06 19:09 
GeneralRe: How to break from an If Statement Pin
_AK_30-Aug-06 19:56
_AK_30-Aug-06 19:56 
AnswerRe: How to break from an If Statement Pin
Guffa30-Aug-06 21:13
Guffa30-Aug-06 21:13 
AnswerRe: How to break from an If Statement Pin
Pooja k30-Aug-06 19:25
Pooja k30-Aug-06 19:25 
GeneralRe: How to break from an If Statement Pin
Guffa30-Aug-06 19:46
Guffa30-Aug-06 19:46 
AnswerRe: How to break from an If Statement Pin
Pooja k30-Aug-06 20:00
Pooja k30-Aug-06 20:00 
AnswerRe: How to break from an If Statement Pin
Martin#30-Aug-06 20:47
Martin#30-Aug-06 20:47 
Hello,

In your case the ShowDialog Method would be better.
You should create a YourMessageBox class, which inherits from windows.forms.
There you can implement a fileselection, okbutton and exitbutton.
If there is no file selected the okbutton is not enabled.
YourMessageBox class can then implement a Filename property (public), which is set if a File was selected.

At the Button Click Events:

private void okbutton_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.OK;
this.Exit();
}

private void exitbutton_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
this.Exit();
}


Code for the class who calls the messagebox:

YourMessageBox mb = new YourMessageBox();

if(mb.ShowDialog() == DialogResult.OK)
{
//mb.Filename
//Do the rest of the code
}

Hope that helps.

All the best,

Martin
Questionwhy do the custom written events NEED to have a client?? Pin
michal.kreslik30-Aug-06 17:44
michal.kreslik30-Aug-06 17:44 
AnswerRe: why do the custom written events NEED to have a client?? Pin
Qhalis30-Aug-06 19:05
Qhalis30-Aug-06 19:05 
GeneralRe: why do the custom written events NEED to have a client?? Pin
michal.kreslik30-Aug-06 20:07
michal.kreslik30-Aug-06 20:07 
GeneralRe: why do the custom written events NEED to have a client?? Pin
mav.northwind30-Aug-06 20:19
mav.northwind30-Aug-06 20:19 
Questionmulticolumn combobox Pin
Amar Chaudhary30-Aug-06 16:36
Amar Chaudhary30-Aug-06 16:36 
AnswerRe: multicolumn combobox Pin
Nader Elshehabi31-Aug-06 1:43
Nader Elshehabi31-Aug-06 1:43 
GeneralRe: multicolumn combobox Pin
Amar Chaudhary31-Aug-06 15:28
Amar Chaudhary31-Aug-06 15:28 
QuestionDataSets Modifying Data Pin
Expert Coming30-Aug-06 16:03
Expert Coming30-Aug-06 16:03 
AnswerRe: DataSets Modifying Data Pin
Muammar©10-Sep-06 0:31
Muammar©10-Sep-06 0:31 
QuestionMatlab to C# Pin
signimage30-Aug-06 16:02
signimage30-Aug-06 16:02 
AnswerRe: Matlab to C# Pin
Expert Coming30-Aug-06 16:06
Expert Coming30-Aug-06 16:06 
Questioncrestal report Pin
TAREQ F ABUZUHRI30-Aug-06 13:59
TAREQ F ABUZUHRI30-Aug-06 13:59 
AnswerRe: crestal report Pin
Judah Gabriel Himango30-Aug-06 14:08
sponsorJudah Gabriel Himango30-Aug-06 14:08 
GeneralRe: crestal report Pin
TAREQ F ABUZUHRI30-Aug-06 21:18
TAREQ F ABUZUHRI30-Aug-06 21:18 
GeneralRe: crestal report Pin
gus_br31-Aug-06 7:36
gus_br31-Aug-06 7:36 
AnswerRe: crestal report Pin
gus_br30-Aug-06 16:09
gus_br30-Aug-06 16:09 
AnswerRe: crestal report Pin
Glen Harvy31-Aug-06 13:10
Glen Harvy31-Aug-06 13:10 

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.