473,405 Members | 2,279 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,405 software developers and data experts.

Reorganising the contents of a list box

I have a list box that has a list of ID numbers for people. The box
actually shows their names though. I want to take this list and
programmatically put it into a text box on the same form in the format,
'Name1, Name2, Name3, Name4, etc.'.

How do I take the contents of the list box and programmatically add it into
the text box in that format?

dixie
Nov 13 '05 #1
2 1163
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

How 'bout this:

==== begin code ====
dim lst as listbox
dim str as string
dim i as integer

set lst = Me!ListBox_Name
for i = 0 to lst.listcount
str = str & lst.column(1,i) & ","
next i
' get rid of the trailing comma
str = left$(str,len(str)-1)

Me!TextBox_name = str
===== end code ====

Syntax of .Column(): .Column(index, row)

Therefore, .Column(1,i) means pull the value of the 2 column (the index
is a zero-based index) on the row indicated by i.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQRwG+oechKqOuFEgEQLQnwCg/AJ2MOdJYARYPtyLxSL0yiq/dOMAoN4+
OJweR9TpXM9OTIswC0IEuoLA
=lEVD
-----END PGP SIGNATURE-----
dixie wrote:
I have a list box that has a list of ID numbers for people. The box
actually shows their names though. I want to take this list and
programmatically put it into a text box on the same form in the format,
'Name1, Name2, Name3, Name4, etc.'.

How do I take the contents of the list box and programmatically add it into
the text box in that format?


Nov 13 '05 #2
Thanks for that MG. It worked straight away with very little fiddling.

dixie

"MGFoster" <me@privacy.com> wrote in message
news:5G*******************@newsread1.news.pas.eart hlink.net...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

How 'bout this:

==== begin code ====
dim lst as listbox
dim str as string
dim i as integer

set lst = Me!ListBox_Name
for i = 0 to lst.listcount
str = str & lst.column(1,i) & ","
next i
' get rid of the trailing comma
str = left$(str,len(str)-1)

Me!TextBox_name = str
===== end code ====

Syntax of .Column(): .Column(index, row)

Therefore, .Column(1,i) means pull the value of the 2 column (the index
is a zero-based index) on the row indicated by i.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQRwG+oechKqOuFEgEQLQnwCg/AJ2MOdJYARYPtyLxSL0yiq/dOMAoN4+
OJweR9TpXM9OTIswC0IEuoLA
=lEVD
-----END PGP SIGNATURE-----
dixie wrote:
I have a list box that has a list of ID numbers for people. The box
actually shows their names though. I want to take this list and
programmatically put it into a text box on the same form in the format,
'Name1, Name2, Name3, Name4, etc.'.

How do I take the contents of the list box and programmatically add it into the text box in that format?

Nov 13 '05 #3

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

Similar topics

1
by: Geoff Berrow | last post by:
I have a textarea on a form whose value is stored in a database. I want to display the contents as an unordered list. At the moment I am using * to start the line and ; to end the line in the...
1
by: Bruce | last post by:
On an HTML form, I have a select list that is fed dynamically with detail records when the master record is displayed on the form. There is also a second lookup list, and want to allow the user...
1
by: stewart | last post by:
I'm writing an app that requires a 3-level optionMenu display. Basically I'm showing the contents of a 3-dimensional matrix. You choose the first level in the first optionMenu, the 2nd level in...
33
by: Jason Heyes | last post by:
I would like to modify the contents of a file, replacing all occurances of one string with another. I wrote these functions: bool read_file(std::string name, std::string &s); bool...
5
by: Jim Cobban | last post by:
I am trying to create a web page in which the contents of one selection list depends upon which element in another selection list is chosen, but where the information to populate the first...
5
by: sifar | last post by:
Hi, This is my first post to this Group. A] I am trying to create a escalation page which will mail an escalation report of a faulty product. Items needed on Page: -----------------------
1
by: rissaofthesaiyajin | last post by:
I have a page with an iframe, and a Javascript function that I need to get the contents of the iframe - what I mean by that is, the text from the list.html file that's in the iframe. It's actually a...
13
Death Slaught
by: Death Slaught | last post by:
I have my entire page in my "main" div. div.main { width: 100%; height: 100%; border: 1px solid gray; } on the left of the page I have a banner.
14
by: jehugaleahsa | last post by:
I have a rather complex need. I have a class that parses web pages and extracts all relevant file addresses. It allows me to download every pdf on a web page, for instance. I would like to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.