Click here to Skip to main content
15,897,273 members
Home / Discussions / C#
   

C#

 
GeneralRe: data conversion problem Pin
elwoofy21-Aug-07 9:24
elwoofy21-Aug-07 9:24 
GeneralRe: data conversion problem Pin
Giorgi Dalakishvili21-Aug-07 9:41
mentorGiorgi Dalakishvili21-Aug-07 9:41 
AnswerRe: data conversion problem Pin
Insincere Dave21-Aug-07 16:28
Insincere Dave21-Aug-07 16:28 
AnswerRe: data conversion problem Pin
elwoofy22-Aug-07 4:26
elwoofy22-Aug-07 4:26 
GeneralRe: data conversion problem Pin
Insincere Dave22-Aug-07 6:45
Insincere Dave22-Aug-07 6:45 
QuestionHow to check a string to see if it’s valid for use in creating a file name Pin
earlgraham21-Aug-07 7:24
earlgraham21-Aug-07 7:24 
AnswerRe: How to check a string to see if it’s valid for use in creating a file name Pin
Brady Kelly21-Aug-07 7:31
Brady Kelly21-Aug-07 7:31 
AnswerRe: How to check a string to see if it’s valid for use in creating a file name Pin
earlgraham21-Aug-07 10:05
earlgraham21-Aug-07 10:05 
Thanks here is the final code it works perfectly...

bool IsValidFilename(String ^fileName)
{
  if ( String::IsNullOrEmpty( fileName ) == true )
    return false;
  
  array<Char>^ invalidFileChar = System::IO::Path::GetInvalidFileNameChars();

  for each ( Char ^i in invalidFileChar )
  {
    if ( fileName->Contains(String::Format("{0}", i)) )
    {
      String ^tmp = String::Format(L" '{0}'  is invalid in a file name.\n", i);
      System::Windows::Forms::MessageBox::Show(gcnew String(tmp),gcnew String(L"Warning"), 
        MessageBoxButtons::OK);
      return false;
    }
  }

  return true;
}


Programmer
Glenn Earl Graham
Austin, TX

GeneralRe: How to check a string to see if it’s valid for use in creating a file name Pin
PIEBALDconsult21-Aug-07 10:50
mvePIEBALDconsult21-Aug-07 10:50 
GeneralRe: How to check a string to see if it’s valid for use in creating a file name Pin
Luc Pattyn21-Aug-07 12:38
sitebuilderLuc Pattyn21-Aug-07 12:38 
AnswerRe: How to check a string to see if it’s valid for use in creating a file name Pin
PIEBALDconsult21-Aug-07 9:59
mvePIEBALDconsult21-Aug-07 9:59 
GeneralRe: How to check a string to see if it’s valid for use in creating a file name Pin
pbraun21-Aug-07 10:49
pbraun21-Aug-07 10:49 
GeneralRe: How to check a string to see if it’s valid for use in creating a file name Pin
PIEBALDconsult21-Aug-07 11:11
mvePIEBALDconsult21-Aug-07 11:11 
AnswerRe: How to check a string to see if it’s valid for use in creating a file name Pin
PIEBALDconsult21-Aug-07 12:14
mvePIEBALDconsult21-Aug-07 12:14 
GeneralRe: How to check a string to see if it’s valid for use in creating a file name Pin
Brady Kelly21-Aug-07 19:29
Brady Kelly21-Aug-07 19:29 
QuestionWindow like left-menu Pin
Muhammad Nauman Yousuf21-Aug-07 6:59
Muhammad Nauman Yousuf21-Aug-07 6:59 
AnswerRe: Window like left-menu Pin
martin_hughes21-Aug-07 9:26
martin_hughes21-Aug-07 9:26 
GeneralRe: Window like left-menu Pin
Muhammad Nauman Yousuf21-Aug-07 17:55
Muhammad Nauman Yousuf21-Aug-07 17:55 
Questionxml file export leaves web page open?? Pin
Venkatesh.P21-Aug-07 6:57
Venkatesh.P21-Aug-07 6:57 
QuestionHow do i draw a smooth linie [modified] Pin
MarkPhB21-Aug-07 6:29
MarkPhB21-Aug-07 6:29 
AnswerRe: How do i draw a smooth linie Pin
Mark Churchill21-Aug-07 19:04
Mark Churchill21-Aug-07 19:04 
GeneralRe: How do i draw a smooth linie Pin
MarkPhB22-Aug-07 7:01
MarkPhB22-Aug-07 7:01 
QuestionAccessing App.Config file Pin
Sha Sea21-Aug-07 6:24
Sha Sea21-Aug-07 6:24 
AnswerRe: Accessing App.Config file Pin
kubben21-Aug-07 7:43
kubben21-Aug-07 7:43 
GeneralRe: Accessing App.Config file Pin
Sha Sea21-Aug-07 10:29
Sha Sea21-Aug-07 10:29 

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.