Question

in my WinFormsApp user can add picture in a folder of hardDrive with SaveFileDialog. if there is a picture the same name as new picture an alert is shown that user must rename the new picture.

how can I change name of the picture with adding a variable integer to name without changing name with user?

Était-ce utile?

La solution

The SaveFileDialog class has a public FileName property that allows you to get or set the file name displayed in the dialog box.

This is how you retrieve the file name that the user specified after they have dismissed the dialog box, but it is also the way that you specify a default file name that initially appears in the dialog box.

So before you call the SaveFileDialog.ShowDialog method, just set the FileName property to the desired file name. If you like, you can retrieve its current value, append a number to it, and set the property to the new string.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top