在Windows窗体中读取excel列并将值写入文本框 [英] Read an excel column in windows forms and write the value to a textbox

查看:255
本文介绍了在Windows窗体中读取excel列并将值写入文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在excel文件中搜索国家/地区名称,并为多个文本框分配这些值。例如:



阿富汗| +4 | AF |喀布尔。



当用户搜索国家名称时,表格将显示时区(+4),国家代码(AF),名称(阿富汗)和首都(喀布尔)有4个不同的文本框。



我的尝试:



到目前为止,我设法找到搜索到的国家/地区的位置,因此如果用户搜索阿富汗,我可以找到位置(A列,第1行),但我不知道如何阅读值及其旁边的行将其分配给多个文本框

解决方案

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

I need to search for a country name in an excel file and assing those values for multiple textboxes. For example:

Afghanistan | +4 | AF | Kabul.

When the user searches for the country name, the form will display the timezone (+4), Country Code (AF), the name (Afghanistan) and the capital city (Kabul) in 4 different textboxes.

What I have tried:

So far I managed to find the location of the searched country, so if the user searches for "Afghanistan" I can locate the position (column A, row 1), but I have no clue about how to read that value and the rows next to it to assign it to the multiple textboxes

解决方案

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


这篇关于在Windows窗体中读取excel列并将值写入文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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