how to save a newly created file..automatically with the default names, when the user close that file with out saving ...if the name is already exists then it create a new name.. how it possible in c# ?...
This is not a good idea. If a user does not save a file but is about to loose some results of work, changes, you should detect this situation and warn the user, for example: "You changes are not saved. Do you really want to close this window?" or something like that. If the user cancels operation, nothing changes; it the user conform loosing the changes, they should be lost. Same thing about saving a file replacing existing file. The appropriate warning is the standard feature of the save file dialog; please look properly.—SA
Don't frustrate the users by something they won't expect, keep sanity.
You don't say what you're using ( winforms, etc ), but most frameworks have an event for a form closing, which you can handle and prompt to save
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)