如果用户没有保存,如何使用c#中的默认名称自动保存文件! [英] how to save a file automatically with default name's in c#?, if the user is not saved it!

查看:187
本文介绍了如果用户没有保存,如何使用c#中的默认名称自动保存文件!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用默认名称自动保存新创建的文件,当用户关闭该文件时不保存 ...如果名称已存在,则创建新名称。怎么可能在c#?...

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# ?...

推荐答案

这不是一个好主意。如果用户没有保存文件但是即将丢失一些工作,更改结果,您应该检测到这种情况并警告用户,例如:您的更改未保存。您真的要关闭此窗口吗?或类似的东西。如果用户取消操作,则没有任何改变;如果用户遵守失去的变更,他们就应该丢失。保存替换现有文件的文件也是如此。相应的警告是保存文件对话框的标准功能;请正确看待。



不要用他们不想要的东西来挫败用户,保持理智。


-SA
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.

Don''t frustrate the users by something they won''t expect, keep sanity.

—SA


你不会说你正在使用什么(winforms等),但大多数框架都有一个事件表单关闭,您可以处理并提示保存
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


这篇关于如果用户没有保存,如何使用c#中的默认名称自动保存文件!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆