简体   繁体   English

如何从Visual Studio中的数据库获得自动完成功能?

[英]How do I get an auto completion from a database in visual studio ?

I'm trying to make a program, which is basically a shopping list. 我正在尝试制作一个程序,基本上是一个购物清单。 The purpose is to type something in, while typing the program will fetch items from the database that matches and you will be able to select an item and write a quantity. 目的是输入内容,而键入程序将从数据库中获取匹配的项目,您将能够选择一个项目并写入数量。 Later I want to sorts this. 稍后我想对它进行排序。

My problem is I have no idea how to make this auto completion thing and I have no idea what I would be searching for, cause I'm sure it's not just called auto completion. 我的问题是我不知道如何制作这种自动完成功能,也不知道要搜索什么,因为我确定它不只是自动完成功能。

I have programmed a lot with C# in Unity and C++ with console apps and also some java in eclipse. 我已经在Unity中使用C#和带有控制台应用程序的C ++进行了大量编程,并且在eclipse中也进行了一些Java编程。 But I have mostly never done anything with visual studio where you are able to design and then program for each item. 但是我几乎从来没有在Visual Studio上做过任何事情,在Visual Studio中,您可以为每个项目设计然后编程。

http://i.imgur.com/6WXDq.jpg <- heres a picture of what I'm going to make. http://i.imgur.com/6WXDq.jpg <-这是我要制作的图片。

I'm not asking anyone to build this for me, I just need to know what I will be searching for to make the first thing work. 我并没有要求任何人为我构建它,我只需要知道要使第一件事起作用的搜索内容即可。

I think you'll need something like this: 我认为您需要这样的东西:

textBox1.AutoCompleteCustomSource = DataHelper.LoadAutoComplete();
textBox1.AutoCompleteMode = AutoCompleteMode.Suggest;
textBox1.AutoCompleteSource = AutoCompleteSource.CustomSource;

In this link there's an example in spanish explaining the autocomplete stuff. 在此链接中,有一个用西班牙语解释自动填充内容的示例。 Hope it help! 希望对您有所帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM