VB保存文本框/标签 [英] VB Saving text boxes / Labels

查看:134
本文介绍了VB保存文本框/标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试多种方法来尝试保存应用程序的信息。



说明:

程序我'我目前正在制作一个带有个人资料管理器的自定义游戏启动器。在概要文件管理器上是用户名和gamertag的字段。我不想保存用户输入的信息,这样如果他们重新启动程序,它将保存他们的信息而不是我在制作时默认添加的信息。



我已经看过如何将文本框保存到文本文件的方法,但是如何对链接到标签的自定义文本框字段起作用呢?



示例:

I''ve been trying multiple methods for trying to save information on the application.

Explanation:
The program I''m currently making is a custom game launcher with a profile manager. And on the profile manager is fields for username, and gamertag. I wan''t to save the information a user inputs so that if they restart the program it will save their information instead of the information I added as default while making it.

I''ve seen methods on how to save textboxes to text files, but how would that work for custom textbox fields that link up to labels?

Example:

label1.text = textbox1.text





文本框中的信息随后会在标签上显示。我如何保存这些信息,以便当我重新启动应用程序时它仍然存在?



The information from the textbox is then active on the label. How would I save this information so when I relaunch the application it''s still there?

推荐答案

创建/打开文件写作

将textbox-1中的信息写入新行中的文件

将文本框2中的信息写入新行中的文件

...依此类推,直到..

将信息从textbox-n写入新行中的文件

保存/关闭文件



* re -start应用



打开文件阅读

从文件中读取第一行信息并分配给textbox-1

从文件中读取第二行信息并分配给textbox-2

...依此类推,直到......

从文件中读取第n行信息并分配给文本框-n

关闭文件



done。
create/open file for writing
write information from textbox-1 to file in a new line
write information from textbox-2 to file in a new line
...and so on, until..
write information from textbox-n to file in a new line
save/close file

*re-start application

open file for reading
read 1st line information from file and assign to textbox-1
read 2nd line information from file and assign to textbox-2
...and so on, until...
read nth line information from file and assign to textbox-n
close file

done.


将信息保存到文本文件然后加载并在启动应用程序时将其分配给文本框..
save the information to a text file then load and assign it to the textbox when the application is launched..


这篇关于VB保存文本框/标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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