如何在程序中进行预设 [英] how to make presets in your program

查看:127
本文介绍了如何在程序中进行预设的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个使用约10个文本框的程序.我想使用组合框(或类似框)来选择预设,以用相应的值填充文本框.如果选择选项A,则文本框必须用A1-A10填充,如果选择B,则文本框应用B1-B10填充,等.
我想在运行时(用户首选项)中编辑预设,并在关闭程序时保存所有预设.启动时必须重新加载所有预设.
您对我应该如何执行操作有任何建议吗?

I''m writing a program that uses about 10 textboxes. I want to use a combobox(or similar) to select presets that fills the textboxes with corresponding values. If I select option A, the textboxes have to be filled with A1-A10, if I select B, the boxes should be filled with B1-B10, ect.
I want to edit presets during runtime (user preferences) and save all when cloosing the program. At startup all presets have to be loaded aigain.
Do you have suggestions how I should do this?

推荐答案

使用设置:
1)在属性"下查看您的项目
2)双击设置.设置
3)添加一个适当的字段.
4)在您的代码中,使用Properties.Settings.Default.NameOfPropertyYouSetAbove访问当前值.
5)在表单关闭"事件中,将上面的属性设置为当前值,然后调用Properties.Settings.Default.Save方法
Use the settings:
1) Look in your project under Properties
2) Double click Settings.Settings
3) Add an appropriate field.
4) In your code, use Properties.Settings.Default.NameOfPropertyYouSetAbove to access the current value.
5) In the Form Close event, set the property above to the current value, and call the Properties.Settings.Default.Save method


这篇关于如何在程序中进行预设的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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