从Excel列填充ComboBox(vb.net) [英] Fill a ComboBox (vb.net) from an Excel Column

查看:114
本文介绍了从Excel列填充ComboBox(vb.net)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好!


我目前正在Visual Studio 2017上编写应用程序Windows窗体(.NET Framework)。


在几乎所有地方搜索之后,我仍然无法找到答案或领导。


我的程序是一个包含多个comboBox的表单,其中包含从Excel列中获取的值及其用途是复制/过去Excel文件的行,其中列的值等于组合框选择的值。


问题是我不知道如何填充组合框。


如果您需要我的代码或项目文件告诉我,任何帮助都会很棒。

解决方案

虽然我不会劝阻你为此制作应用程序,因为你可能还有其他目的,这听起来像你可以用Excel中的VLOOKUP做的事情。


无论如何,这应该是一个相当简单的问题,即选择工作表中的单元格范围并循环遍历每个单元格的值单元格。


这些链接应该会有所帮助:


https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/interop/walkthrough-office-programming (也包括VB)


https://msdn.microsoft.com/en-us/library/office/dn301006.aspx




Hello everyone!

I'm currently coding an Application Windows Form (.NET Framework) on Visual Studio 2017.

After having search almost everywhere, I still can't find an answer or a lead.

My program is a form containing multiple comboBox which will contain values taken from the Excel columns, and its purpose is to copy/past rows of the Excel File where the value of the columns equal the comboBox selected value.

And the problem is that I don't know how to fill the comboBox.

Any help would be great, if you need my code or Project file tell me.

解决方案

While I won't discourage you from making an app for this, as you may have other purposes in mind as well, this sounds like something you could do with a VLOOKUP in Excel.

Anyway, this should be a fairly simple matter of selecting the range of cells within the worksheet and the looping through the values of each cell.

These links should be helpful:

https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/interop/walkthrough-office-programming (covers VB as well)

https://msdn.microsoft.com/en-us/library/office/dn301006.aspx


这篇关于从Excel列填充ComboBox(vb.net)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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