为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

vb中防止将重复项目添加到列表框控件中(VB prevents repeated items from being added to the ListBox control)

2017-10-20 3页 doc 16KB 71阅读

用户头像

is_594905

暂无简介

举报
vb中防止将重复项目添加到列表框控件中(VB prevents repeated items from being added to the ListBox control)vb中防止将重复项目添加到列表框控件中(VB prevents repeated items from being added to the ListBox control) vb中防止将重复项目添加到列表框控件中(VB prevents repeated items from being added to the ListBox control) In csdn_VB, prevent repeated items from being added to list box controls. VB prevents r...
vb中防止将重复项目添加到列表框控件中(VB prevents repeated items from being added to the ListBox control)
vb中防止将重复项目添加到列表框控件中(VB prevents repeated items from being added to the ListBox control) vb中防止将重复项目添加到列表框控件中(VB prevents repeated items from being added to the ListBox control) In csdn_VB, prevent repeated items from being added to list box controls. VB prevents repeated items from being added to the ListBox control Author: Tan Weng -- the ListBox control in Visual Basic contains a list of items. This article describes how to check items in a list No longer exists, and how to add new items to the listbox control. Search for duplicate items using the SendMessage function When developing applications in Visual Basic, you can use list box controls to create a list of projects. To add a new project to the list, you can use the AddItem method, which cannot automatically report in the list box control Is there any duplicate information in the component, so you must first check it before adding the new project to the list. You can use the SendMessage function of the Windows application programming interface (API) to control the list box Searches for the specified item that allows messages to be sent to the operating system. In the example of this article, we Let the SendMessage function execute a LB_FINDSTRING message in the listbox control. - -- LB_FINDSTRING messages allow you to search for a project that matches the target string in a list box control. this The first parameter of the message is the type of search that you want to have, and you want to set the value to 0, which represents the first from the list box control Two projects start searching. The second parameter is a string that ends with NULL, which is the actual item you want to search for. If the LB_FINDSTRING message returns a value of -1, the target string is not found in the listbox control, At this point, you can use the AddItem method to add new items to the listbox control. If the item is already in the list In existence, you can simply display a message box or perform some other process to notify the user of a repeating item The object already exists in the listbox control. Sample program The program shows how to make sure that a list box contains one that is added to the control Projects. - - 1. start a new project in Visual Basic, and establish the Form1 by default. - 2. add the following constants and declarations to the general declaration section of Form1. (note that the declaration statement needs to be taken Write in a line: ---- Private, Declare, Function, SendMessageFind, Lib, user32, Alias "SendMessageA" (ByVal, hWnd, As, Long, ByVal, wMsg, As, Long, ByVal, wParam, As) Integer, ByVal, lParam, As, String) As Long ---- Const WM_USER = &H400 ---- Const, LB_ERR = (-1) ---- Const LB_FINDSTRING = &H18F 3. add the following code to the Form_Load event in Form1:
/
本文档为【vb中防止将重复项目添加到列表框控件中(VB prevents repeated items from being added to the ListBox control)】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索