473,394 Members | 1,956 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,394 software developers and data experts.

How to display "all" the items of listbox?

Hi,
I want to display ALL the items (includes unselected items) of listbox
control. How can i code this? Should i use "for each" or other?

For example:
Assume you have a listbox with 3 items sth like:

Hello
There
Guys

And i want to display them in the same format within a messagebox with
seperated each line(maybe i have to use " + vbnewline"?).

How to do this?

Thanks!
Dec 23 '07 #1
3 11687

"kimiraikkonen" <ki*************@gmail.comkirjoitti viestissä
news:c2**********************************@t1g2000p ra.googlegroups.com...
Hi,
I want to display ALL the items (includes unselected items) of listbox
control. How can i code this? Should i use "for each" or other?

For example:
Assume you have a listbox with 3 items sth like:

Hello
There
Guys

And i want to display them in the same format within a messagebox with
seperated each line(maybe i have to use " + vbnewline"?).

How to do this?

Thanks!
ListBox1.Items.Add("1")
ListBox1.Items.Add("2")
ListBox1.Items.Add("3")

Dim buffer As New System.Text.StringBuilder
For i As Integer = 0 To ListBox1.Items.Count - 1
buffer.AppendLine(ListBox1.Items(i).ToString)
Next
MsgBox(buffer.ToString)

-Teemu

Dec 23 '07 #2
"kimiraikkonen" <ki*************@gmail.comschrieb
Hi,
I want to display ALL the items (includes unselected items) of
listbox control. How can i code this? Should i use "for each" or
other?

For example:
Assume you have a listbox with 3 items sth like:

Hello
There
Guys

And i want to display them in the same format within a messagebox
with seperated each line(maybe i have to use " + vbnewline"?).

How to do this?
If language = VB 2008 AndAlso all items in the list are Strings:

MsgBox(String.Join(vbCrLf, Me.ListBox1.Items.Cast(Of String).ToArray))
Armin
Dec 23 '07 #3

"Armin Zingler" <az*******@freenet.dekirjoitti viestissä
news:%2****************@TK2MSFTNGP06.phx.gbl...
If language = VB 2008 AndAlso all items in the list are Strings:

MsgBox(String.Join(vbCrLf, Me.ListBox1.Items.Cast(Of String).ToArray))
Quite handy. LINQ makes everything too easy. :-)

-Teemu

Dec 23 '07 #4

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

Similar topics

1
by: LazyAnt | last post by:
Does DB2 process "ALL" subquery by "nested iteration" strategy, or using its own special algorithm? For example, assume r(A, B, C) and s(D, E, F) are two relations, consider the following query:...
2
by: Dale Ring | last post by:
Access 2000 I am trying to add "ALL" to a combo that is used to filter a query. When "ALL" is selected no records show instead of ALL records showing. I have setup a "dummy" table (tblDum)...
1
by: Neil H | last post by:
Hi All I am doing a multiple table and field database search, and my problem lies in the options that a user has. In each field, the user can specify a specific value or any value. I take each...
3
by: tobhamlet | last post by:
If one is using a query as a Row Source on a Form, is there a way to set up a blank space, or to insert the word "ALL" in a combo box that represents ALL combo box row items. The scenario is as...
0
by: Greg Strong | last post by:
Hello All, In the past I've used a combo box with the 'row source' being an Access SQL union query to select "All" or 1 for only 1 criteria in a query. An example is as follows: SELECT 0 As...
4
by: meganrobertson22 | last post by:
Hi Everyone- I have a question about how to add and then use the "All" selection in a combo box. I am trying to figure out how to: (1) add "All" as a selection to a combo box and then (2)...
3
by: google | last post by:
This is something I've done plenty of times in '97, but I can't seem to get it to work correctly in Access 2003. Say, for example, I have a form with an unbound combobox, the data source is a...
2
by: Murphy | last post by:
Our website contains subdirectories for each subsidiary company, each company has it's own look and feel to the pages in their subdirectory although they are all part of the main website. The...
4
by: google | last post by:
Hi Hope someone can help me with this - have been staring at this problem all day, and with the cold I've got, just don't seem to be able to figure it out! I've got two tables, here with some...
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: 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
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: 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
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
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...
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
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...
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...

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.