I do not know of any particular feature that does that.
You would have to write your own function to test your filename.
--
Regards,
Dennis JD Myrén
Oslo Kodebureau
"Chris" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks .. you are right.
>
> But if I set that property ValidateNames on true, and so C#
> wil check for valid file names, how can I check a priori if
> my file name is valid. In order to replace it with a valid
> default file name.
>
> In C# there must be a simple method for that I guess ...
>
> Some help woud be nice ...
>
> Bye,
>
> Chris
> "Dennis Myrén" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> ValidateNames is a property, not a method.
>> You need to initially set this to true, then the names
> will be validated.
>>
>> By the way, the character ] is a valid character in a
> filename.
>>
>>
>>
>> --
>> Regards,
>> Dennis JD Myrén
>> Oslo Kodebureau
>> "Chris" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>> > Hi,
>> >
>> > In C# I tried to save a file from a generated file name.
>> > Just before launching the dialog I check for a valid
> file
>> > name to be sure.
>> >
>> > There for I used the method ValidateNames from the save
>> > dialog.
>> >
>> > The strange thing is that sometimes the save dialogue
>> > crashes on invalid file names (containing chars
> like ] ),
>> > but the method ValidateNames return true.
>> >
>> > Code looks like:
>> > saveFileDialog = new
> System.Windows.Forms.SaveFileDialog();
>> >
>> > saveFileDialog.FileName = (...) <--- generated file
> name
>> > may contan invalid chars
>> >
>> > if (!saveFileDialog.ValidateNames) <-- method returns
> true
>> > for invalid file names ??
>> >
>> > {
>> >
>> > saveFileDialog.FileName =
>> > "MyChart."+saveFileDialog.DefaultExt; <-- if name is
>> > invalid, supply valid file name as default
>> >
>> > }
>> >
>> > if (saveFileDialog.ShowDialog() == DialogResult.OK)
>> >
>> > {
>> >
>> > }
>> >
>> >
>> >
>> > Any idea what may be wrong ?
>> >
>> > Thanks.
>> >
>> > Bye
>> >
>> > Chris
>> >
>> >
>> >
>> >
>> >
>> >
>> >
>>
>>
>
|