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

C#

 
GeneralRe: Writing complex overload methods for LINQ queries Pin
Sascha Lefèvre2-Feb-16 7:19
professionalSascha Lefèvre2-Feb-16 7:19 
AnswerRe: Writing complex overload methods for LINQ queries Pin
Kenneth Haugland12-Feb-16 6:50
mvaKenneth Haugland12-Feb-16 6:50 
GeneralRe: Writing complex overload methods for LINQ queries Pin
Sascha Lefèvre12-Feb-16 9:34
professionalSascha Lefèvre12-Feb-16 9:34 
QuestionSaveFileDialog Pin
Mrkhoza1-Feb-16 23:28
professionalMrkhoza1-Feb-16 23:28 
AnswerRe: SaveFileDialog PinPopular
OriginalGriff1-Feb-16 23:40
mveOriginalGriff1-Feb-16 23:40 
AnswerRe: SaveFileDialog Pin
BillWoodruff2-Feb-16 0:02
professionalBillWoodruff2-Feb-16 0:02 
AnswerRe: SaveFileDialog Pin
Dave Kreskowiak2-Feb-16 1:27
mveDave Kreskowiak2-Feb-16 1:27 
GeneralRe: SaveFileDialog Pin
BillWoodruff2-Feb-16 2:13
professionalBillWoodruff2-Feb-16 2:13 
Dave Kreskowiak wrote:
Also, what if the use accidentally click SaveAs? How are you giving them a way out without performing the Save operation?
With a WinForms SaveFileDialog you can define a 'FileDialog.FileOk EventHandler, in which you can cancel the 'Save operation, and keep the dialog open.
C#
private void saveFileDialog1_FileOk(object sender, CancelEventArgs e)
{
    if (saveFileDialog1.FileName == @"C:\Users\SomeUser\Desktop\NoGo.xxx"
        || saveFileDialog1.FileName.ToLower().Contains("forbidden"))
    {
        e.Cancel = true;
    }
}
And, when the SaveFileDialog 'returns is closed: of course, you've got another chance to validate and do nothing based on the selected File. And, you've got the power to restrict files viewed by means of the 'Filter Property.

My preference is to never enable showing any kind of Dialog unless the pre-conditions for its valid use are met. So, yeah, that means disabled MenuItems, or Buttons, etc.

Unfortunately, the FolderBrowserDialog does not expose any Events.
«In art as in science there is no delight without the detail ... Let me repeat that unless these are thoroughly understood and remembered, all “general ideas” (so easily acquired, so profitably resold) must necessarily remain but worn passports allowing their bearers short cuts from one area of ignorance to another.» Vladimir Nabokov, commentary on translation of “Eugene Onegin.”

GeneralRe: SaveFileDialog Pin
Dave Kreskowiak2-Feb-16 3:51
mveDave Kreskowiak2-Feb-16 3:51 
GeneralRe: SaveFileDialog Pin
John Torjo3-Feb-16 13:39
professionalJohn Torjo3-Feb-16 13:39 
AnswerRe: SaveFileDialog Pin
Kevin Marois3-Feb-16 11:35
professionalKevin Marois3-Feb-16 11:35 
QuestionTextbox help(edited) Pin
Member 122873371-Feb-16 20:25
Member 122873371-Feb-16 20:25 
AnswerRe: Textbox help(edited) Pin
BillWoodruff1-Feb-16 20:55
professionalBillWoodruff1-Feb-16 20:55 
GeneralRe: Textbox help(edited) Pin
Member 122873372-Feb-16 8:58
Member 122873372-Feb-16 8:58 
AnswerRe: Textbox help(edited) Pin
OriginalGriff1-Feb-16 20:57
mveOriginalGriff1-Feb-16 20:57 
GeneralRe: Textbox help(edited) Pin
BillWoodruff1-Feb-16 21:06
professionalBillWoodruff1-Feb-16 21:06 
GeneralRe: Textbox help(edited) Pin
OriginalGriff1-Feb-16 21:36
mveOriginalGriff1-Feb-16 21:36 
GeneralRe: Textbox help(edited) Pin
BillWoodruff1-Feb-16 22:32
professionalBillWoodruff1-Feb-16 22:32 
GeneralRe: Textbox help(edited) Pin
Member 122873372-Feb-16 8:54
Member 122873372-Feb-16 8:54 
QuestionTextbox help Pin
Member 122873371-Feb-16 20:25
Member 122873371-Feb-16 20:25 
QuestionTextbox binding/ Pin
Member 122873371-Feb-16 20:24
Member 122873371-Feb-16 20:24 
Questiondoes MethodInvoker will not work on win XP? Pin
Gilbert Consellado1-Feb-16 18:09
professionalGilbert Consellado1-Feb-16 18:09 
AnswerRe: does MethodInvoker will not work on win XP? Pin
John Torjo1-Feb-16 22:57
professionalJohn Torjo1-Feb-16 22:57 
GeneralRe: does MethodInvoker will not work on win XP? Pin
Gilbert Consellado2-Feb-16 2:17
professionalGilbert Consellado2-Feb-16 2:17 
QuestionRe: does MethodInvoker will not work on win XP? Pin
Alan N1-Feb-16 23:09
Alan N1-Feb-16 23:09 

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.