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

Array to ListBox

Bob
In VBA, I could fill a listbox with data from an array
like so:

Dim ListArray(?, ?)

.... Fill ListArray ...

ListBox1.List = ListArray

How do I do this in VB .NET?
Nov 20 '05 #1
4 44461
* "Bob" <an*******@discussions.microsoft.com> scripsit:
In VBA, I could fill a listbox with data from an array
like so:

Dim ListArray(?, ?)

... Fill ListArray ...

ListBox1.List = ListArray

How do I do this in VB .NET?


\\\
Dim astr() As String = {"Hello", "World", "Foo", "Bar"}
Me.ListBox1.Items.AddRange(astr)
///

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
Nov 20 '05 #2
Bob
Thank you so much!
-----Original Message-----
* "Bob" <an*******@discussions.microsoft.com> scripsit:
In VBA, I could fill a listbox with data from an array
like so:

Dim ListArray(?, ?)

... Fill ListArray ...

ListBox1.List = ListArray

How do I do this in VB .NET?


\\\
Dim astr() As String = {"Hello", "World", "Foo", "Bar"}
Me.ListBox1.Items.AddRange(astr)
///

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>

<http://www.plig.net/nnq/nquote.html>
.

Nov 20 '05 #3
Hi Bob,

Have a go with this:
ListBox1.DataSource = ListArray

DataSource will accept an Array or an ArrayList as well as the usual
'serious' Data types.

Regards,
Fergus
Nov 20 '05 #4
Bob
Thanks! =)
-----Original Message-----
Hi Bob,

Have a go with this:
ListBox1.DataSource = ListArray

DataSource will accept an Array or an ArrayList as well as the usual'serious' Data types.

Regards,
Fergus
.

Nov 20 '05 #5

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

Similar topics

7
by: 00_ChInkPoIntD12 | last post by:
Can anyone confirm there isn't a Sort() method for WebControl Listbox in Asp.net? It is rather simple to write a method to do the sorting, but just wondering I shouldn't invent the wheel if...
3
by: George | last post by:
Sub ExcelToListBox() Dim xRange As Object Dim ary Dim xValue As String xRange = oXL.Range("A1:A9") 'has letters A-H ary = xRange.value xValue = ary(3, 1) 'xValue = C...
11
by: Zorpiedoman | last post by:
The problem is this: I have a list box. I set an array list as the datasource. I remove an item from the array list. I set the listbox datasource to nothing. I set the listbox datasource to...
14
by: Paul_Madden via DotNetMonster.com | last post by:
Basically I have a listbox to which I add simple STRING items- I have a progress bar which I increment whenever I populate another portion of the complete set of items I wish to add. What I observe...
6
by: Paul | last post by:
Hi All, Framework 1.1 listbox control unable to DataBind I've been googling for an answer to this query that appears quite a lot, but none, it seem, answers my problem directly. I am...
1
by: =?Utf-8?B?R3VzIENodWNo?= | last post by:
I have a ListBox with the SelectionMode set to MultiSimple. How can I iterate thru it using a for next loop to fill an array? Listbox For Row 1 = Array(1) Row 2 = Array(2) Next And so on. --
0
by: crespo | last post by:
hi,everyone. I have a question about using listbox in a customized user control.I use a listbox directly in a asp.net page and it works very well,but when I use the same code in a user...
1
by: Sunray | last post by:
I have a form called the sales form and i have 2 sets of listboxes So what happens is. i add items form the bottom set of list boxes which are bound to a data base to the top set of list boxes which...
15
by: kronecker | last post by:
Is it possible to address a listbox in a general manner depending on it's number eg ListBox1. ListBox2. etc
3
by: Sweetiecakes | last post by:
Hi I have an string array containing file paths. I have added them to a ListBox with AddRange(); When I delete an item from the ListBox, how can I delete the same item from the original...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.