473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to accumulate text in a combobox?

Hi,

Each time the user selects an item from a combobox, I want that string to
get appended to the values that were already selected. The result is that
the combo is accumulating text each time the user selects an item from its
list. I want the delete and backspace keys to function normally, as well
as all the other properties of the combobox.

Does anybody know the easiest way to do this?

Thanks!
Norm
Nov 13 '05 #1
14 2213
On Sun, 19 Sep 2004 16:22:11 -0500, Norm wrote:
Hi,

Each time the user selects an item from a combobox, I want that string to
get appended to the values that were already selected. The result is that
the combo is accumulating text each time the user selects an item from its
list. I want the delete and backspace keys to function normally, as well
as all the other properties of the combobox.

Does anybody know the easiest way to do this?

Thanks!
Norm


Code the Combo Box AfterUpdate event:
[ControlName] = [ControlName] & Me![ComboName]
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #2
fredg <fg******@example.invalid> wrote in
news:1f****************************@40tude.net:
On Sun, 19 Sep 2004 16:22:11 -0500, Norm wrote:
Hi,

Each time the user selects an item from a combobox, I want that
string to get appended to the values that were already selected. The
result is that the combo is accumulating text each time the user
selects an item from its list. I want the delete and backspace keys
to function normally, as well as all the other properties of the
combobox.

Does anybody know the easiest way to do this?

Thanks!
Norm


Code the Combo Box AfterUpdate event:
[ControlName] = [ControlName] & Me![ComboName]


Hi Fred,

Thanks for the reply, but that's not quite right. [ControlName] and Me!
[ComboName] both contain the new value selected by the user. The result
is that the old value gets lost and the combo becomes equal to the new
value string & the new value string.

Norm
Nov 13 '05 #3
On Sun, 19 Sep 2004 17:26:05 -0500, Norm wrote:
fredg <fg******@example.invalid> wrote in
news:1f****************************@40tude.net:
On Sun, 19 Sep 2004 16:22:11 -0500, Norm wrote:
Hi,

Each time the user selects an item from a combobox, I want that
string to get appended to the values that were already selected. The
result is that the combo is accumulating text each time the user
selects an item from its list. I want the delete and backspace keys
to function normally, as well as all the other properties of the
combobox.

Does anybody know the easiest way to do this?

Thanks!
Norm


Code the Combo Box AfterUpdate event:
[ControlName] = [ControlName] & Me![ComboName]


Hi Fred,

Thanks for the reply, but that's not quite right. [ControlName] and Me!
[ComboName] both contain the new value selected by the user. The result
is that the old value gets lost and the combo becomes equal to the new
value string & the new value string.

Norm


You are not correct in your statement.

Perhaps you should try it first, or perhaps you tried it but you did
not write the expression properly.
[ControlName] = [ControlName] & Me![ComboName]
If you select 3 items, one at a time, from a combo box, the result in
the text box will be the 3 items, one after the other.
Select Yes, then Maybe, then No, and the text box will read
YesMaybeNo.

If you incorrectly wrote:
[ControlName] = Me!ComboName
then you would see only the last item selected.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #4
fredg <fg******@example.invalid> wrote in
news:1c*****************************@40tude.net:
On Sun, 19 Sep 2004 17:26:05 -0500, Norm wrote:
fredg <fg******@example.invalid> wrote in
news:1f****************************@40tude.net:
On Sun, 19 Sep 2004 16:22:11 -0500, Norm wrote:

Hi,

Each time the user selects an item from a combobox, I want that
string to get appended to the values that were already selected.
The result is that the combo is accumulating text each time the
user selects an item from its list. I want the delete and
backspace keys to function normally, as well as all the other
properties of the combobox.

Does anybody know the easiest way to do this?

Thanks!
Norm

Code the Combo Box AfterUpdate event:
[ControlName] = [ControlName] & Me![ComboName]


Hi Fred,

Thanks for the reply, but that's not quite right. [ControlName] and
Me! [ComboName] both contain the new value selected by the user. The
result is that the old value gets lost and the combo becomes equal to
the new value string & the new value string.

Norm


You are not correct in your statement.

Perhaps you should try it first, or perhaps you tried it but you did
not write the expression properly.
[ControlName] = [ControlName] & Me![ComboName]
If you select 3 items, one at a time, from a combo box, the result in
the text box will be the 3 items, one after the other.
Select Yes, then Maybe, then No, and the text box will read
YesMaybeNo.

If you incorrectly wrote:
[ControlName] = Me!ComboName
then you would see only the last item selected.


Thanks again for your reply.

I think the problem is that I didn't fully explain what I'm trying to
do. I want to update the selected text in the combo with the
accumulated values. So...[ControlName] = [ComboName]. Using your
expression, it would be [ComboName] = [ComboName] & Me![ComboName].

I did try your expression and I'm not getting the correct result.

Any other ideas?

Norm
Nov 13 '05 #5
On Sun, 19 Sep 2004 20:45:10 -0500, Norm wrote:
fredg <fg******@example.invalid> wrote in
news:1c*****************************@40tude.net:
On Sun, 19 Sep 2004 17:26:05 -0500, Norm wrote:
fredg <fg******@example.invalid> wrote in
news:1f****************************@40tude.net:

On Sun, 19 Sep 2004 16:22:11 -0500, Norm wrote:

> Hi,
>
> Each time the user selects an item from a combobox, I want that
> string to get appended to the values that were already selected.
> The result is that the combo is accumulating text each time the
> user selects an item from its list. I want the delete and
> backspace keys to function normally, as well as all the other
> properties of the combobox.
>
> Does anybody know the easiest way to do this?
>
> Thanks!
> Norm

Code the Combo Box AfterUpdate event:
[ControlName] = [ControlName] & Me![ComboName]

Hi Fred,

Thanks for the reply, but that's not quite right. [ControlName] and
Me! [ComboName] both contain the new value selected by the user. The
result is that the old value gets lost and the combo becomes equal to
the new value string & the new value string.

Norm


You are not correct in your statement.

Perhaps you should try it first, or perhaps you tried it but you did
not write the expression properly.
[ControlName] = [ControlName] & Me![ComboName]
If you select 3 items, one at a time, from a combo box, the result in
the text box will be the 3 items, one after the other.
Select Yes, then Maybe, then No, and the text box will read
YesMaybeNo.

If you incorrectly wrote:
[ControlName] = Me!ComboName
then you would see only the last item selected.


Thanks again for your reply.

I think the problem is that I didn't fully explain what I'm trying to
do. I want to update the selected text in the combo with the
accumulated values. So...[ControlName] = [ComboName]. Using your
expression, it would be [ComboName] = [ComboName] & Me![ComboName].

I did try your expression and I'm not getting the correct result.

Any other ideas?

Norm


You're correct. I did misread your request, and thought you wanted to
add text to a control,(a common procedure) based upon selections in
the combo box.

It seems like a rather strange request and makes no sense to me.
You already have a at least one value in the combo (let's say "Joe)
that you select, and you want to change the value in the combo to
"JoeJoe"?
And then what? "JoeJoeJoeJoe".
The usual purpose of a combo is to select a value and insert into a
control or field not into itself.

--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #6
fredg <fg******@example.invalid> wrote in
news:16*****************************@40tude.net:
On Sun, 19 Sep 2004 20:45:10 -0500, Norm wrote:
fredg <fg******@example.invalid> wrote in
news:1c*****************************@40tude.net:
On Sun, 19 Sep 2004 17:26:05 -0500, Norm wrote:

fredg <fg******@example.invalid> wrote in
news:1f****************************@40tude.net:

> On Sun, 19 Sep 2004 16:22:11 -0500, Norm wrote:
>
>> Hi,
>>
>> Each time the user selects an item from a combobox, I want that
>> string to get appended to the values that were already selected.
>> The result is that the combo is accumulating text each time the
>> user selects an item from its list. I want the delete and
>> backspace keys to function normally, as well as all the other
>> properties of the combobox.
>>
>> Does anybody know the easiest way to do this?
>>
>> Thanks!
>> Norm
>
> Code the Combo Box AfterUpdate event:
> [ControlName] = [ControlName] & Me![ComboName]

Hi Fred,

Thanks for the reply, but that's not quite right. [ControlName]
and Me! [ComboName] both contain the new value selected by the
user. The result is that the old value gets lost and the combo
becomes equal to the new value string & the new value string.

Norm

You are not correct in your statement.

Perhaps you should try it first, or perhaps you tried it but you did
not write the expression properly.
[ControlName] = [ControlName] & Me![ComboName]
If you select 3 items, one at a time, from a combo box, the result
in the text box will be the 3 items, one after the other.
Select Yes, then Maybe, then No, and the text box will read
YesMaybeNo.

If you incorrectly wrote:
[ControlName] = Me!ComboName
then you would see only the last item selected.


Thanks again for your reply.

I think the problem is that I didn't fully explain what I'm trying to
do. I want to update the selected text in the combo with the
accumulated values. So...[ControlName] = [ComboName]. Using your
expression, it would be [ComboName] = [ComboName] & Me![ComboName].

I did try your expression and I'm not getting the correct result.

Any other ideas?

Norm


You're correct. I did misread your request, and thought you wanted to
add text to a control,(a common procedure) based upon selections in
the combo box.

It seems like a rather strange request and makes no sense to me.
You already have a at least one value in the combo (let's say "Joe)
that you select, and you want to change the value in the combo to
"JoeJoe"?
And then what? "JoeJoeJoeJoe".
The usual purpose of a combo is to select a value and insert into a
control or field not into itself.


Yes, that is exactly what I want to do. The reason is that the user is
selecting multiple items from the combo, and all of their selections
need to be captured in this string. I don't have the space to use
checkboxes or radio buttons to select these items, and have many combos
on the form. By selecting multiple items in the combo and concatenating
them into one string, the user can assemble whatever string they desire
into the combo. Unfortunately, I believe this is really the way I need
to do it.

Any ideas on how?

Norm
Nov 13 '05 #7
Norm <od*****@comcast.net> wrote in
news:Xn******************************@216.196.97.1 36:
fredg <fg******@example.invalid> wrote in
news:16*****************************@40tude.net:
On Sun, 19 Sep 2004 20:45:10 -0500, Norm wrote:
fredg <fg******@example.invalid> wrote in
news:1c*****************************@40tude.net:

On Sun, 19 Sep 2004 17:26:05 -0500, Norm wrote:

> fredg <fg******@example.invalid> wrote in
> news:1f****************************@40tude.net:
>
>> On Sun, 19 Sep 2004 16:22:11 -0500, Norm wrote:
>>
>>> Hi,
>>>
>>> Each time the user selects an item from a combobox, I want that
>>> string to get appended to the values that were already selected.
>>> The result is that the combo is accumulating text each time the
>>> user selects an item from its list. I want the delete and
>>> backspace keys to function normally, as well as all the other
>>> properties of the combobox.
>>>
>>> Does anybody know the easiest way to do this?
>>>
>>> Thanks!
>>> Norm
>>
>> Code the Combo Box AfterUpdate event:
>> [ControlName] = [ControlName] & Me![ComboName]
>
> Hi Fred,
>
> Thanks for the reply, but that's not quite right. [ControlName]
> and Me! [ComboName] both contain the new value selected by the
> user. The result is that the old value gets lost and the combo
> becomes equal to the new value string & the new value string.
>
> Norm

You are not correct in your statement.

Perhaps you should try it first, or perhaps you tried it but you
did not write the expression properly.
[ControlName] = [ControlName] & Me![ComboName]
If you select 3 items, one at a time, from a combo box, the result
in the text box will be the 3 items, one after the other.
Select Yes, then Maybe, then No, and the text box will read
YesMaybeNo.

If you incorrectly wrote:
[ControlName] = Me!ComboName
then you would see only the last item selected.
Thanks again for your reply.

I think the problem is that I didn't fully explain what I'm trying
to do. I want to update the selected text in the combo with the
accumulated values. So...[ControlName] = [ComboName]. Using your
expression, it would be [ComboName] = [ComboName] & Me![ComboName].

I did try your expression and I'm not getting the correct result.

Any other ideas?

Norm


You're correct. I did misread your request, and thought you wanted to
add text to a control,(a common procedure) based upon selections in
the combo box.

It seems like a rather strange request and makes no sense to me.
You already have a at least one value in the combo (let's say "Joe)
that you select, and you want to change the value in the combo to
"JoeJoe"?
And then what? "JoeJoeJoeJoe".
The usual purpose of a combo is to select a value and insert into a
control or field not into itself.


Yes, that is exactly what I want to do. The reason is that the user
is selecting multiple items from the combo, and all of their
selections need to be captured in this string. I don't have the space
to use checkboxes or radio buttons to select these items, and have
many combos on the form. By selecting multiple items in the combo and
concatenating them into one string, the user can assemble whatever
string they desire into the combo. Unfortunately, I believe this is
really the way I need to do it.

Any ideas on how?

Norm


Fred,

Based on your original suggestion to me, I think I solved the problem.
Thanks for taking the time to reply which enabled me to discover the
solution! Norm
Nov 13 '05 #8
Wes
Try this on the after update.

Me.YourField = Me.YourField & Me.ComboBox
Norm <od*****@comcast.net> wrote in message news:<Xn*******************************@216.196.97 .136>...
Norm <od*****@comcast.net> wrote in
news:Xn******************************@216.196.97.1 36:
fredg <fg******@example.invalid> wrote in
news:16*****************************@40tude.net:
On Sun, 19 Sep 2004 20:45:10 -0500, Norm wrote:

fredg <fg******@example.invalid> wrote in
news:1c*****************************@40tude.net:

> On Sun, 19 Sep 2004 17:26:05 -0500, Norm wrote:
>
>> fredg <fg******@example.invalid> wrote in
>> news:1f****************************@40tude.net:
>>
>>> On Sun, 19 Sep 2004 16:22:11 -0500, Norm wrote:
>>>
>>>> Hi,
>>>>
>>>> Each time the user selects an item from a combobox, I want that
>>>> string to get appended to the values that were already selected.
>>>> The result is that the combo is accumulating text each time the
>>>> user selects an item from its list. I want the delete and
>>>> backspace keys to function normally, as well as all the other
>>>> properties of the combobox.
>>>>
>>>> Does anybody know the easiest way to do this?
>>>>
>>>> Thanks!
>>>> Norm
>>>
>>> Code the Combo Box AfterUpdate event:
>>> [ControlName] = [ControlName] & Me![ComboName]
>>
>> Hi Fred,
>>
>> Thanks for the reply, but that's not quite right. [ControlName]
>> and Me! [ComboName] both contain the new value selected by the
>> user. The result is that the old value gets lost and the combo
>> becomes equal to the new value string & the new value string.
>>
>> Norm
>
> You are not correct in your statement.
>
> Perhaps you should try it first, or perhaps you tried it but you
> did not write the expression properly.
> [ControlName] = [ControlName] & Me![ComboName]
> If you select 3 items, one at a time, from a combo box, the result
> in the text box will be the 3 items, one after the other.
> Select Yes, then Maybe, then No, and the text box will read
> YesMaybeNo.
>
> If you incorrectly wrote:
> [ControlName] = Me!ComboName
> then you would see only the last item selected.
>

Thanks again for your reply.

I think the problem is that I didn't fully explain what I'm trying
to do. I want to update the selected text in the combo with the
accumulated values. So...[ControlName] = [ComboName]. Using your
expression, it would be [ComboName] = [ComboName] & Me![ComboName].

I did try your expression and I'm not getting the correct result.

Any other ideas?

Norm

You're correct. I did misread your request, and thought you wanted to
add text to a control,(a common procedure) based upon selections in
the combo box.

It seems like a rather strange request and makes no sense to me.
You already have a at least one value in the combo (let's say "Joe)
that you select, and you want to change the value in the combo to
"JoeJoe"?
And then what? "JoeJoeJoeJoe".
The usual purpose of a combo is to select a value and insert into a
control or field not into itself.


Yes, that is exactly what I want to do. The reason is that the user
is selecting multiple items from the combo, and all of their
selections need to be captured in this string. I don't have the space
to use checkboxes or radio buttons to select these items, and have
many combos on the form. By selecting multiple items in the combo and
concatenating them into one string, the user can assemble whatever
string they desire into the combo. Unfortunately, I believe this is
really the way I need to do it.

Any ideas on how?

Norm


Fred,

Based on your original suggestion to me, I think I solved the problem.
Thanks for taking the time to reply which enabled me to discover the
solution! Norm

Nov 13 '05 #9
sl****@sbcglobal.net (Wes) wrote in
news:3e**************************@posting.google.c om:
Try this on the after update.

Me.YourField = Me.YourField & Me.ComboBox


Since I am updating the combo itself, your expression would become:

Me.ComboBox = Me.ComboBox & Me.ComboBox

Am I understanding you correctly? That expression would not produce the
correct result.

Norm
Nov 13 '05 #10

"Norm" <od*****@comcast.net> wrote in message
news:Xn*******************************@216.196.97. 136...
sl****@sbcglobal.net (Wes) wrote in
news:3e**************************@posting.google.c om:
Try this on the after update.

Me.YourField = Me.YourField & Me.ComboBox


Since I am updating the combo itself, your expression would become:

Me.ComboBox = Me.ComboBox & Me.ComboBox

Am I understanding you correctly? That expression would not produce the
correct result.


I fairly sure you'll have to use a separate control to accumulate the results.
--
I don't check the Email account attached
to this message. Send instead to...
RBrandt at Hunter dot com
Nov 13 '05 #11
Why not save yourself a whole lot of hassle and just use a
multi-select listbox? Comboboxes really are not built to do what you
want. MSLB's are.
Nov 13 '05 #12
Have you tried

comboBox1.Text&=comboBox1.SelectedItem.ToString()

?
with regards,
J.V.Ravichandran
- http://www.geocities.com/
jvravichandran
- http://www.411asp.net/func/search?
qry=Ravichandran+J.V.&cob=aspnetpro
- http://www.southasianoutlook.com
- http://www.MSDNAA.Net
- http://www.csharphelp.com
- http://www.poetry.com/Publications/
display.asp?ID=P3966388&BN=999&PN=2
- Or, just search on "J.V.Ravichandran"
at http://www.Google.com

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #13
pi********@hotmail.com (Pieter Linden) wrote in
news:bf**************************@posting.google.c om:
Why not save yourself a whole lot of hassle and just use a
multi-select listbox? Comboboxes really are not built to do what you
want. MSLB's are.


Great suggestion, however I have specific requirements which make the MSLB
not ideal. Each Combo/Listbox (there are over a dozen on each form) can
only be 2 characters in height to fit them all on the page and obviously
have a limited width. Scrolling through a listbox of 2 character height
only enables the user to see 1 item per line. It's much nicer with the
combo when they drop it down they can see all the choices but the control
still only takes up 2 lines in height.

Given the short height of the box, the look and feel is just better with a
Combo. Thanks for the idea though.

Norm
Nov 13 '05 #14
Ravichandran J.V. <jv************@yahoo.com> wrote in news:414ff977$0$26101
$c******@news.newsgroups.ws:
Have you tried

comboBox1.Text&=comboBox1.SelectedItem.ToString()

?
with regards,
J.V.Ravichandran
- http://www.geocities.com/
jvravichandran


I tried that expression but there were multiple errors and it didn't
execute. Thanks for the try.

Norm
Nov 13 '05 #15

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

Similar topics

0
by: thomaz | last post by:
I use the DataSource like below to fill a Combobox: comboBox1.DataSource = dataSet1.Tables; comboBox1.DisplayMember = "ProductName"; When the user types any keyboard key i use the DROPDOWN...
2
by: benjamin_r | last post by:
I am trying to use the std::accumulate function. When I compile the following code I get: error C2780: '_Ty std::accumulate(_InIt,_InIt,_Ty,_Fn2)' : expects 4 arguments - 3 provided. It should...
3
by: Mark P | last post by:
How to solve this? 1. Place a ComboBox in a form 2. On the ComboBox Properties window change the Items to hold: a b c d
4
by: Keith | last post by:
Hello - this started out as a minor annoyance - and now is starting to bother me more and more - I'm hoping someone can help me. I would like to have a combobox display - NOT initially be blank...
5
by: cesco | last post by:
I have a set of pairs defined as follow: set< pair<UserEquipment*, double> > numberOfFreqSlotsToAdd; and I need to iterate through all the elements of the set in order accumulate the second...
4
by: Vish | last post by:
Hi, I need to make the text on a combobox that is disabled to be drawn with a black color. I was not able to find any help on this online. The drawItem seems to apply only for the dropdpwn...
4
by: Matt | last post by:
I have been searching all over the web for a way to sort a DataGridView based on the actual text being shown in a ComboBox column as opposed to the underlying value (an ID in this case). Can anyone...
5
by: CCLeasing | last post by:
Hello, I have searched google but can not find a straight forward answer to my problem. Hopefuly someone will be kind enough to offer their expertise. Please forgive if this seems a bit convoluted...
7
by: Henrique A. Menarin | last post by:
I want to create a function _and so that I could write vector<boolasserts; //... bool b = _and(asserts); and it "anded" all the elements in the vector. I implemented it like this:
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.