Solved

ComboBox

Posted on 2006-11-13
2
379 Views
Last Modified: 2010-04-23
Good afternoon folks

I have a combobox that is populated by a table during the form load .....

I would like to be able to select a item in the combobox and based on criteria, have the item removed from the combobox. I do not want to re-populate the combobox due to the amout of data. I figure I can capture the combobox.selectedindex and remove the item based the index value but having little luck.

Thanks
0
Comment
Question by:stephenz43
2 Comments
 
LVL 6

Accepted Solution

by:
riyazthad earned 500 total points
ID: 17935038
I hope you are populating combox using dataset. In your ComboBox1_SelectedIndexChanged event, take value of selected item like ComboBox1.SelectedValue and based on value you need to repopulate  combo. Better to put binding in a sub or function.

Then u can reduce dataset using ds.Select("ProductID<>" & ComboBox1.SelectedValue)

If you are using DataView, you can use RowFilter method to reduce further and rebind.

I hope this will work out.

0
 

Author Comment

by:stephenz43
ID: 17935070
actually using a reader to populate the combobox....

This seems to work

cbobox.items.removeAt( someindexvalue)

I capture the selectedIndex in the SelectedIndexChanged event as you suggested

Seems to work pretty good

Thanks
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question