组合框的问题 [英] Problems with a combobox

查看:84
本文介绍了组合框的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家早上好。



我正在将旧的Access 2010应用程序转换为VB Net 2017 / SQL Server,我遇到了ComboBox的问题。



访问是使用控件Cuadro Combinado(组合框或英文或多或少的方形),所以我猜我应该使用ComboBox控件在VB网络中实现相同的功能(你知道,我的客户希望在vb Net中看到完全相同的行为)。



但现在我发现组合框没有在功能上执行一些,(或者至少,我不知道该怎么做)



- 它不显示查询的标题填充组合,如果我手动设置,当我使用垂直滚动时,标题会向上滚动;它们不会保持固定。



- 数据不是按列分隔的。我需要使用5列不同的数据。



- 当我在组合中写一个字符时,下拉列表不会自动打开,(当我写字符时) )看到所有以我在组合上放置的首字母开头的元素,以及那些我已经看过其他类型控件的信件。



Access中的控件完美地完成了这一操作。我只是不明白为什么VB net不行。



我的ComboBox有这样的方式吗?



使用ComboBox或其他控件是否正确?



我尝试过:



我正在尝试使用ListBox,但我觉得这很难做到这一点。

解决方案

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

DataGridView中的多列组合框 [ ^ ]

这个可能是有趣的也是:如何从头开始创建自定义ComboBox [<一个href =https://www.codeproject.com/Articles/30958/How-to-create-a-custom-ComboBox-from-scratch\"target =_ blanktitle =New Window> ^ ]


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



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

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



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

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

Vb.net ComboBox自动填充 [ ^ ]

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



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



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

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 youtube.

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

Hope this helps. Kindly.


这篇关于组合框的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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