473,772 Members | 2,292 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to delete a ComboBox item

I have a usercontrol that inherits from ComboBox

I'd like to add the feature that the user can delete any item

Best would be that he could right click an element and a messagebox would
ask if he wanted to delete that element

I can't find an event that would enable me to do that.

I could copy the items into a text box, let him edit it and put them back

Not to fond of that

Got any other idea of how it might be done??
Thanks
Dec 3 '06 #1
9 2458
Franky,

It is very important to answer you in that how your combobox is populated.
One of the meanings of combo is that you can do it from a datasource and
from an inbuild array.

Cor

" Franky" <fr***********@ a-znet.comschreef in bericht
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>I have a usercontrol that inherits from ComboBox

I'd like to add the feature that the user can delete any item

Best would be that he could right click an element and a messagebox would
ask if he wanted to delete that element

I can't find an event that would enable me to do that.

I could copy the items into a text box, let him edit it and put them back

Not to fond of that

Got any other idea of how it might be done??
Thanks

Dec 3 '06 #2
OHM
Morning Cor ,

How are you doing ?

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******** *******@TK2MSFT NGP02.phx.gbl.. .
Franky,

It is very important to answer you in that how your combobox is populated.
One of the meanings of combo is that you can do it from a datasource and
from an inbuild array.

Cor

" Franky" <fr***********@ a-znet.comschreef in bericht
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>>I have a usercontrol that inherits from ComboBox

I'd like to add the feature that the user can delete any item

Best would be that he could right click an element and a messagebox would
ask if he wanted to delete that element

I can't find an event that would enable me to do that.

I could copy the items into a text box, let him edit it and put them back

Not to fond of that

Got any other idea of how it might be done??
Thanks


Dec 3 '06 #3
Missed you a while saw your previous message, are you going to be again
active here?

Cor

"OHM" <lkjhlkjschre ef in bericht
news:ex******** ********@TK2MSF TNGP06.phx.gbl. ..
Morning Cor ,

How are you doing ?

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******** *******@TK2MSFT NGP02.phx.gbl.. .
>Franky,

It is very important to answer you in that how your combobox is
populated. One of the meanings of combo is that you can do it from a
datasource and from an inbuild array.

Cor

" Franky" <fr***********@ a-znet.comschreef in bericht
news:%2******* *********@TK2MS FTNGP03.phx.gbl ...
>>>I have a usercontrol that inherits from ComboBox

I'd like to add the feature that the user can delete any item

Best would be that he could right click an element and a messagebox
would ask if he wanted to delete that element

I can't find an event that would enable me to do that.

I could copy the items into a text box, let him edit it and put them
back

Not to fond of that

Got any other idea of how it might be done??
Thanks



Dec 3 '06 #4
OHM

I'm going to try, but I've been incredibly busy with commerical work so I'll
probably be contributing in little bursts.
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
Missed you a while saw your previous message, are you going to be again
active here?

Cor

"OHM" <lkjhlkjschre ef in bericht
news:ex******** ********@TK2MSF TNGP06.phx.gbl. ..
>Morning Cor ,

How are you doing ?

"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******* ********@TK2MSF TNGP02.phx.gbl. ..
>>Franky,

It is very important to answer you in that how your combobox is
populated. One of the meanings of combo is that you can do it from a
datasource and from an inbuild array.

Cor

" Franky" <fr***********@ a-znet.comschreef in bericht
news:%2****** **********@TK2M SFTNGP03.phx.gb l...
I have a usercontrol that inherits from ComboBox

I'd like to add the feature that the user can delete any item

Best would be that he could right click an element and a messagebox
would ask if he wanted to delete that element

I can't find an event that would enable me to do that.

I could copy the items into a text box, let him edit it and put them
back

Not to fond of that

Got any other idea of how it might be done??
Thanks



Dec 3 '06 #5
Populated from things the user previously typed into the ComboBox's Text box

Thanks for the interest


"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******** *******@TK2MSFT NGP02.phx.gbl.. .
Franky,

It is very important to answer you in that how your combobox is populated.
One of the meanings of combo is that you can do it from a datasource and
from an inbuild array.

Cor

" Franky" <fr***********@ a-znet.comschreef in bericht
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
>>I have a usercontrol that inherits from ComboBox

I'd like to add the feature that the user can delete any item

Best would be that he could right click an element and a messagebox would
ask if he wanted to delete that element

I can't find an event that would enable me to do that.

I could copy the items into a text box, let him edit it and put them back

Not to fond of that

Got any other idea of how it might be done??
Thanks


Dec 3 '06 #6
Franky,

Than you can just find the index with findstringexact and remove the index.

Cor

" Franky" <fr***********@ a-znet.comschreef in bericht
news:OO******** ******@TK2MSFTN GP02.phx.gbl...
Populated from things the user previously typed into the ComboBox's Text
box

Thanks for the interest


"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:%2******** *******@TK2MSFT NGP02.phx.gbl.. .
>Franky,

It is very important to answer you in that how your combobox is
populated. One of the meanings of combo is that you can do it from a
datasource and from an inbuild array.

Cor

" Franky" <fr***********@ a-znet.comschreef in bericht
news:%2******* *********@TK2MS FTNGP03.phx.gbl ...
>>>I have a usercontrol that inherits from ComboBox

I'd like to add the feature that the user can delete any item

Best would be that he could right click an element and a messagebox
would ask if he wanted to delete that element

I can't find an event that would enable me to do that.

I could copy the items into a text box, let him edit it and put them
back

Not to fond of that

Got any other idea of how it might be done??
Thanks



Dec 3 '06 #7
Cor

This is more a design question rather that an implementation question.

I know how to delete items.

I can't think of a neat way for the user to select the items to be deleted.

One possibility is for the user to click an item so that it appears in the
text box, and the button might say "Delete item showing in Textbox"

It just occurred to me that the items might be able to display a checkbox
next to them - is that possible in a combobox -I'll have to check. If that
is possible the user could check the items to be deleted while the dropdown
list is showing.

A quick test led me to believe Combobox gets a click event if I click in the
textbox or cause a dropdown. It does not get one if I click and item in the
dropdown.

Maybe in WndProc I could catch the right click and figure out which item the
user clicked. Does that seem like a way to go???
....
>>>>I have a usercontrol that inherits from ComboBox

I'd like to add the feature that the user can delete any item

Best would be that he could right click an element and a messagebox
would ask if he wanted to delete that element

I can't find an event that would enable me to do that.

I could copy the items into a text box, let him edit it and put them
back
....
Dec 3 '06 #8
Franky,

Why you don't simple drag a contextmenustri p on your form
Set the first menu
Set that as property in the combobox

And you are almost ready,

Cor

" Franky" <fr***********@ a-znet.comschreef in bericht
news:ej******** ******@TK2MSFTN GP04.phx.gbl...
Cor

This is more a design question rather that an implementation question.

I know how to delete items.

I can't think of a neat way for the user to select the items to be
deleted.

One possibility is for the user to click an item so that it appears in the
text box, and the button might say "Delete item showing in Textbox"

It just occurred to me that the items might be able to display a checkbox
next to them - is that possible in a combobox -I'll have to check. If that
is possible the user could check the items to be deleted while the
dropdown list is showing.

A quick test led me to believe Combobox gets a click event if I click in
the textbox or cause a dropdown. It does not get one if I click and item
in the dropdown.

Maybe in WndProc I could catch the right click and figure out which item
the user clicked. Does that seem like a way to go???
...
>>>>>I have a usercontrol that inherits from ComboBox
>
I'd like to add the feature that the user can delete any item
>
Best would be that he could right click an element and a messagebox
would ask if he wanted to delete that element
>
I can't find an event that would enable me to do that.
>
I could copy the items into a text box, let him edit it and put them
back
>

...

Dec 3 '06 #9
Cor

In Opening I built a contextmenustri p that has items like

Delete EXE
Delete TXT

The items in the combobox being EXE and TXT

Clicking one deletes it

Very nice
Thanks
"Cor Ligthert [MVP]" <no************ @planet.nlwrote in message
news:OK******** *****@TK2MSFTNG P02.phx.gbl...
Franky,

Why you don't simple drag a contextmenustri p on your form
Set the first menu
Set that as property in the combobox

And you are almost ready,

Cor

" Franky" <fr***********@ a-znet.comschreef in bericht
news:ej******** ******@TK2MSFTN GP04.phx.gbl...
>Cor

This is more a design question rather that an implementation question.

I know how to delete items.

I can't think of a neat way for the user to select the items to be
deleted.

One possibility is for the user to click an item so that it appears in
the text box, and the button might say "Delete item showing in Textbox"

It just occurred to me that the items might be able to display a checkbox
next to them - is that possible in a combobox -I'll have to check. If
that is possible the user could check the items to be deleted while the
dropdown list is showing.

A quick test led me to believe Combobox gets a click event if I click in
the textbox or cause a dropdown. It does not get one if I click and item
in the dropdown.

Maybe in WndProc I could catch the right click and figure out which item
the user clicked. Does that seem like a way to go???
...
>>>>>>I have a usercontrol that inherits from ComboBox
>>
>I'd like to add the feature that the user can delete any item
>>
>Best would be that he could right click an element and a messagebox
>would ask if he wanted to delete that element
>>
>I can't find an event that would enable me to do that.
>>
>I could copy the items into a text box, let him edit it and put them
>back
>>

...


Dec 3 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3453
by: Phil | last post by:
My form uses a dataset containing two tables, a base table (Contact) and a lookup table (Insurer). My combobox is bound as follows: DataSource = datasetContact DisplayMember = Insurer.InsurerName ValueMember = Insurer.InsurerId DataBindings.SelectedValue = Contact.InsurerId It generally works fine. I am able to navigate records and
6
4026
by: Bernd Smits | last post by:
Hi, I would like to delete a record (with commandbutton) of a table associated to a combobox, when I select a certain value in the combobox (the value I select is associated with the record that I want to delete. For example: I have a form associated to a table, which has only one field (PatientN°), and a combobox (within the form) that contains the list of values (PatientN°) contained in the table. Now I would like to select a value in...
7
23530
by: NCrum | last post by:
I want to set the Default value of a Combobox for any changeable record and have got this working but it is totaly unsatisfactory see the code below I loop through the items in the Combo looking for a match between cVal and the selectedValue then stop when I do have a match the obvious problem is that each iteration fires the selectedIndexChanged but also for a large list this will slow everything down. There must be a better way int...
4
2618
by: Strahimir Antoljak | last post by:
Has anyone experienced problems with a combo box SelectIndex property? Is there a limit to the number of Items for a combo box? Namely, when I set programmatically ComboBox.SelectIndex property with 2000 Items listed in the ComboBox, SelectIndex property accepts assigned value. However, when I try to use SelectIndex
6
7811
by: Sakharam Phapale | last post by:
Hi All, How to fill one ComboBox from other ComboBox control? 1) Only setting the reference does the trick but doesn't show items in control. If you see in immediate window, it shows the item count correctly
5
6790
by: =?Utf-8?B?bWljaGFlbCBzb3JlbnM=?= | last post by:
I want to create a customized ComboBox where the methods ComboBox.Items.Add and ComboBox.Items.Insert will behave thusly: -- If the item is not present, add it. -- If the item is present, set the selected index to the item (without adding a duplicate). I know the basics of inheriting from user controls, so if this was merely overriding a method of ComboBox I could do it. But how does one go about overriding a method of the Items...
4
6666
by: Jerad Rose | last post by:
I'm baffled by this -- is there not a typed object used for ComboBox Items? Best I can tell, all of the methods for ComboBox that accept an Item are of type Object. Why in the world is a common/standard .NET control accepting an Object as a parameter type? In Web Forms, there is a ListItem object that can be passed in to add/retrieve objects from a DropDownItems collection. I searched Google groups, and all the solutions I'm finding...
9
5524
by: Greg (codepug | last post by:
I have a combobox with the RowSourceType set to Table/Query and the RowSource is an SQL query that references a separate lookup table that contains the data that can be selected in the combobox. Also, limittolist & autoexpand are set to Yes. Control source is set to the main table field where the data will go. I can highlight the data that was previously selected in the combobox, and press the delete key to remove it, but after I move...
11
3325
Frinavale
by: Frinavale | last post by:
This question is going to sound a little crazy but.........How do you set the selected item in a ComboBox? I am populating a ComboBox with a bunch of instances of a custom private class: For Each s as Something In MyListOfSomethings MyComboBox.Items.Add(New XYZListItem(s.ID,s.description)) Next MyComboBox.ValueMember = "ID" MyComboBox.DisplayMember = "Description"
0
9621
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9454
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10264
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10039
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9914
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8937
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5355
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5484
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2851
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.