如何将数据从Excel工作表传输到VB.NET文本框,反之亦然。 [英] How do I transfer data from excel worksheet to VB.NET text boxes and vise versa.

查看:127
本文介绍了如何将数据从Excel工作表传输到VB.NET文本框,反之亦然。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!我想学习如何将数据从Excel工作表复制到VB.net应用程序。



让我说我有表格1.



表格1有:

3个文本框:姓名,地址和年龄字段。

2按钮:保存并取消



然后我有一个excel工作表,其中包含数据。



假设excel工作表上的数据是数千行,我怎样才能以编程方式将它们从Excel工作表中获取到我的VB.Net字段?

(例如也许很简单,但我的实际要求不是这么简单,我只是想学习如何从excel工作表中获取数据到VB.net应用程序。)



我尝试了什么:



我试图搜索谷歌我的问题,但我找不到任何匹配的东西,我也试过自动化,但它也不符合要求。我无法保存将在Excel和我的vb.net应用程序之间进行交互的宏。请帮忙!谢谢!



添加信息。



我学到了如何将数据从VB.net传输到Excel使用VB.net代码,但似乎我必须使用VBA将数据从excel传输到vb.net。

解决方案

参见使用MS Excel(xls / xlsx)使用MDAC和Oledb [ ^ ]。

Hi Guys! I would like to learn how to copy data from a Excel worksheet to a VB.net application.

Lets say i have form 1.

Form 1 has:
3 text boxes : a name, address and age field.
2 Buttons : Save and Cancel

Then i have a excel worksheet, which contains the data.

Assuming that the data on the excel worksheet is thousands of rows, how could i programmatically get them from the excel sheet to my VB.Net Field?
(the example maybe simple, but my actual requirement is not this simple, i just want to learn how to get data from a excel worksheet to a VB.net application.)

What I have tried:

I tried searching google about my problem, but i cant find anything that would match, I also tried "Automation", but it also does not fit the requirement. I can't save a macro that would interact between Excel and my vb.net application. please do help! thank you!

ADD INFO.

I Learned How to transfer data from VB.net to Excel using VB.net codes, but it seems i have to use VBA to transfer data from excel to vb.net.

解决方案

See Working with MS Excel(xls / xlsx) Using MDAC and Oledb[^].


这篇关于如何将数据从Excel工作表传输到VB.NET文本框,反之亦然。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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