且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

组合框的问题

更新时间:2023-10-19 19:32:16

也许这就是你要找的,但要注意它需要实体框架:

DataGridView中的多列组合框 [ ^ ]

这个可能是有趣的也是:如何从头开始创建自定义ComboBox [ ^ ]


尽管Access和VB.NET中的两个控件都具有相同的名称,但它们的实现方式并不相同,从而呈现出不同的行为。



您可以尝试从头开始实现自己的.NET ComboBox,但我不建议这样做,因为您似乎对.NET世界很陌生。

幸运的是,这是一个常见的已经处理过的要求; CP甚至有一篇很好的文章:多列组合框 [ ^ ]。即使链接控件是用C#开发的,也不意味着你必须将其代码转换为VB.NET才能使用它;你只需要在你的项目中引用定义它的.dll,你就可以在你的VB.NET项目中使用它了。



关于你的显示要求匹配键入的元素,这称为自动完成,并由组合框对象支持。

这是一个链接,它将解释如何正确使用它(它需要配置为使用) :

Vb.net ComboBox自动填充 [ ^ ]

您还可以谷歌搜索.net combo autocomplete 你会得到几个结果,包括***上的视频。



如果你看起来有些模糊不清,不要犹豫,要求进一步的精确度。



希望这会有所帮助。麻烦。

Good morning everybody.

I''m converting an old Access 2010 application to VB Net 2017 / SQL Server and I''m having problems with a ComboBox.

Access is using a control "Cuadro Combinado" (Combined Box or square in english more or less) in a form, so I guessed I should use a ComboBox control to achieve the same functions in VB net (You know, my clients want to see exactly the same behavior in vb Net).

But now I found the combobox doesn´t perform some of this functionally, (or at least, I don´t know how to do it)

- it doesn´t display the headers of the query that populates the Combo, and if I put it manually, the headers scroll up when I use the vertical scrolling; they don´t remain fixed.

- The data is NOT separated in columns. I need to uses 5 columns with different data.

- When I write a characters in the combo, the dropdownlist doesn''t open automatically, (as I write characters) to see all the elements that start with the initial letter I put on the combo, and the consecuent ones, like I''ve seen other type of controls do.

The control in Access, does that perfectly. I just can''t see why VB net doesn''t.

Is there a way my ComboBox works that way ?

Should it be correct to use a ComboBox or another control instead ?

What I have tried:

I''m trying to use a ListBox instead, but it''s hard for me to think that this can not be done.

Maybe this is what you are looking for, but be warned it needs the Entity Framework:
Multi-Column Combo Box in a DataGridView[^]
And this one might be of interest too: How to create a custom ComboBox from scratch[^]


Despite both controls in Access and VB.NET have the same name, they are not implemented the same way and thus present distinct behaviours.

You can try to implement your own .NET ComboBox from scratch, but I would not recommend that since you seem to be quite new to .NET world.
Fortunately, this is a common requirement which already has been treated; CP even has a good article on this: Multi Column ComboBox[^]. Even if linked control is developped in C#, that does not mean you have to translate its code to VB.NET to use it; you just have to reference the .dll defining it in your project, and you will be able to use it from your VB.NET project.

Regarding your requirement to display elements matching the typing, this is called auto-completion and is supported by the combo box object.
Here is a link which will explain how to use it properly (it needs to be configured to be used):
Vb.net ComboBox Autocomplete[^]
You can also google for ".net combo autocomplete" and you will get several results, including videos on ***.

Don''t hesitate to ask for further precisions if something seems obscure to you.

Hope this helps. Kindly.