保存和检索表单上控件的数据 [英] save and retrieve data for controls on my form

查看:76
本文介绍了保存和检索表单上控件的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我的表单上有4个文本框,1个列表框和2个datagridviews.我在文本框和列表框中使用我确定的值填充datagridview.填充datagridview后,我将一些数据输入到datagridview中以继续进行计算.我想知道是否可以将输入到表单的输入数据(即textboxex,Listbox和datagridview中的数据)保存到文件中,以便下次在我的工具中运行该文件时可以检索这些数据.

我知道我们必须使用savefiledialog和openfiledialog命令来保存检索数据.我不知道如何保存文本框,列表框和datagridview中的数据.

我是一个初学者,这个东西有时正在谈论.如果有人可以提出建议,这将非常有帮助.在此先感谢您

Hello All,

I have 4 textboxes , 1 list box and 2 datagridviews on my form. I populate the datagridview with the values I eneter into the textbox and list box. Once the datagridview is populated I enter some data into my datagridview to carry on with my calculations. I was wondering if I could save the input I gave to my form i.e, data in my textboxex, Listbox and datagridview into a file so that I can retrieve this data the next time I run this file from my tool.

I know we have to use the savefiledialog and openfiledialog commands to save a retrieve the data. I do not know how I could save the data from my textbox, listbox and datagridview.

I am a beginner and this stuff is talking sometime. If someone could give a heads up it will be very helpful. Thanks in advance

推荐答案

可以使用多种方法保存数据和格式化数据.

您可以将所有内容存储为逗号分隔的文件.您可以将其全部存储在Excel文件中.您可以将其全部存储在Access文件中.首先,您必须确定最好的(有时是最简单的)数据存储方式,以及是否要确保数据的安全性.

一旦确定了这一点,就必须弄清楚如何访问它.假设您正在做一个简单的逗号分隔文件.您可能要用Google搜索"Vb .NET File IO",并且会得到很多结果.例如:如何在Visual Basic 2005或Visual Basic .NET中执行基本文件I/O [ ^ ].然后,假设您想更进一步并加密文件,以便其他人看不到数据(但这并不意味着他们无法搞乱数据).您可能要用Google搜索"VB .NET加密解密文件".您将在此处获得名为在VB.NET中加密/解密文件(使用Rijndael) [ ^ ].

或者,如果您决定要使用Excel文件,则可以使用Google"VB .NET Excel",您会得到很多结果.
There are any number of ways that you could save your data and any number of ways to format your data.

You could store everything as a comma-delimited file. You could store it all in an Excel file. You could store it all in an Access file. First, you have to figure out what the best (and sometimes easiest) way of storing your data would be and if you want that data to be secure.

Once you''ve decided that, you have to figure out how to access it. Let''s say you were doing a simple comma-delimited file. You would want to google "Vb .NET File IO" and you would get a lot of results. For example: How to do basic file I/O in Visual Basic 2005 or in Visual Basic .NET[^]. Then, let''s say you wanted to take it a step further and encrypt the file so other people couldn''t see the data (doesn''t mean they can''t screw it up though). You would want to google "VB .NET encrypt decrypt file". You would get an article on here called Encrypt/Decrypt Files in VB.NET (Using Rijndael)[^].

Or, if you decided you wanted to use an excel file then google "VB .NET Excel" and you will get a lot of results.


这篇关于保存和检索表单上控件的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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