如何在用户在vb中更改时添加保留在程序中的变量 [英] How do i add a variable that stays in the program when changed by the user in vb

查看:82
本文介绍了如何在用户在vb中更改时添加保留在程序中的变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我基本上想知道如何在VB中创建可由用户更改的变量,例如更改读取文件的程序的文件路径。我认为一种方法是制作一个配置文件,但如果我能做到这一点,那就更好了,因为我正在做的事情。



我的尝试:



这是我从未尝试过的事情我不知道从哪里开始所以我没有尝试任何东西。

I basically want to know how to make variables that can be changed by the user in VB, like for changing a file path for programs that read files for example. I think one way would be to make a config file, but if I can do it without that it would be better for the sake of what I'm doing with it.

What I have tried:

This is something I've never attempted to do I'm not sure where to start so I haven't tried anything.

推荐答案

除了ppolymorphe所写的内容:



看看这里:



使用应用程序设置和用户设置 [ ^ ] - 抽象文件处理,以便您可以作为属性访问设置



c# - 保存应用程序设置的最佳做法在Windows窗体应用程序 - 堆栈溢出 [ ^ ]



我应该在哪里存储我的数据? [ ^ ] - 如果你想自己处理文件
In addition to what ppolymorphe wrote:

Take a look here:

Using Application Settings and User Settings[^] - abstracts the file handling so that you can access the settings as properties

c# - Best practice to save application settings in a Windows Forms Application - Stack Overflow[^]

Where should I store my data?[^] - if you want to handle the file writing yourself


引用:

我认为一种方法是制作一个配置文件,但如果我能做到这一点,那么它会更好我正在做什么。

I think one way would be to make a config file, but if I can do it without that it would be better for the sake of what I'm doing with it.

这是唯一的方法!

您必须使用配置文件来存储程序运行之间必须保留的所有设置。

别无选择。

It is the only way!
You have to use a config file to store all your settings that must persist between program runs.
No choice.


这篇关于如何在用户在vb中更改时添加保留在程序中的变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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