Home All Groups Group Topic Archive Search About

how to delete a ComboBox item

Author
3 Dec 2006 3:37 AM
Franky
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

Author
3 Dec 2006 6:10 AM
Cor Ligthert [MVP]
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

Show quoteHide quote
" Franky" <frankieNOSPAM@a-znet.com> schreef in bericht
news:%236ckWxoFHHA.5004@TK2MSFTNGP03.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
>
Author
3 Dec 2006 8:22 AM
OHM
Morning Cor ,

How are you doing ?

Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:%231uMxFqFHHA.536@TK2MSFTNGP02.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" <frankieNOSPAM@a-znet.com> schreef in bericht
> news:%236ckWxoFHHA.5004@TK2MSFTNGP03.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
>>
>
>
Author
3 Dec 2006 9:40 AM
Cor Ligthert [MVP]
Missed you a while saw your previous message, are you going to be again
active here?

Cor

Show quoteHide quote
"OHM" <lkjhlkj> schreef in bericht
news:exKG%23QrFHHA.3616@TK2MSFTNGP06.phx.gbl...
> Morning Cor ,
>
> How are you doing ?
>
> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
> news:%231uMxFqFHHA.536@TK2MSFTNGP02.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" <frankieNOSPAM@a-znet.com> schreef in bericht
>> news:%236ckWxoFHHA.5004@TK2MSFTNGP03.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
>>>
>>
>>
>
>
Author
3 Dec 2006 9:44 AM
OHM
I'm going to try, but I've been incredibly busy with commerical work so I'll
probably be contributing in little bursts.


Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:%23e5jQ7rFHHA.4712@TK2MSFTNGP04.phx.gbl...
> Missed you a while saw your previous message, are you going to be again
> active here?
>
> Cor
>
> "OHM" <lkjhlkj> schreef in bericht
> news:exKG%23QrFHHA.3616@TK2MSFTNGP06.phx.gbl...
>> Morning Cor ,
>>
>> How are you doing ?
>>
>> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
>> news:%231uMxFqFHHA.536@TK2MSFTNGP02.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" <frankieNOSPAM@a-znet.com> schreef in bericht
>>> news:%236ckWxoFHHA.5004@TK2MSFTNGP03.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
>>>>
>>>
>>>
>>
>>
>
>
Author
3 Dec 2006 2:01 PM
Franky
Populated from things the user previously typed into the ComboBox's Text box

Thanks for the interest






Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:%231uMxFqFHHA.536@TK2MSFTNGP02.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" <frankieNOSPAM@a-znet.com> schreef in bericht
> news:%236ckWxoFHHA.5004@TK2MSFTNGP03.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
>>
>
>
Author
3 Dec 2006 2:10 PM
Cor Ligthert [MVP]
Franky,

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

Cor

Show quoteHide quote
" Franky" <frankieNOSPAM@a-znet.com> schreef in bericht
news:OOsFXOuFHHA.3668@TK2MSFTNGP02.phx.gbl...
> Populated from things the user previously typed into the ComboBox's Text
> box
>
> Thanks for the interest
>
>
>
>
>
>
> "Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
> news:%231uMxFqFHHA.536@TK2MSFTNGP02.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" <frankieNOSPAM@a-znet.com> schreef in bericht
>> news:%236ckWxoFHHA.5004@TK2MSFTNGP03.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
>>>
>>
>>
>
>
Author
3 Dec 2006 3:24 PM
Franky
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
>>>>

....
Author
3 Dec 2006 3:51 PM
Cor Ligthert [MVP]
Franky,

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

And you are almost ready,

Cor

Show quoteHide quote
" Franky" <frankieNOSPAM@a-znet.com> schreef in bericht
news:ejoKw8uFHHA.2296@TK2MSFTNGP04.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
>>>>>
>
> ...
>
Author
3 Dec 2006 6:44 PM
Franky
Cor

In Opening I built a contextmenustrip that has items like

Delete EXE
Delete TXT

The items in the combobox being EXE and TXT

Clicking one deletes it

Very nice


Thanks


Show quoteHide quote
"Cor Ligthert [MVP]" <notmyfirstn***@planet.nl> wrote in message
news:OKtTRKvFHHA.536@TK2MSFTNGP02.phx.gbl...
> Franky,
>
> Why you don't simple drag a contextmenustrip on your form
> Set the first menu
> Set that as property in the combobox
>
> And you are almost ready,
>
> Cor
>
> " Franky" <frankieNOSPAM@a-znet.com> schreef in bericht
> news:ejoKw8uFHHA.2296@TK2MSFTNGP04.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
>>>>>>
>>
>> ...
>>
>
>