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

Listbox list to Array

Hi there,

I've got a form with a listbox (lstWrkFiles) that populated with a number of
files. I'm trying to pass this list of files to an array (so I can use it
later). However, I've the code below "Sub FileArray()" is meant to fire
when I click on the btnNext1 button, but nothing happens. Can anyone spot
what I'm doing wrong?

Thanks

John

Private Sub btnNext1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNext1.Click

'Populate Array

FileArray()

End Sub

Public Sub FileArray()

Dim List As New ArrayList

Dim filePath As String

For Each filePath In lstWrkFiles.Items

List.Add(filePath)

Next

Dim Item As String

For Each Item In List

Console.WriteLine(Item)

Next

Console.ReadLine()

End Sub
Nov 21 '05 #1
4 3544
Q
Hey John,

I tried out your code and it seems to work correctly.
The output of your application goes to the debug-window.
I think your problem is the following:
I quote from MSDN help on "Console Class":

" The console class provides basic support for applications that read
characters from, and write characters to, the console.
If the console does not exist, as in a Windows-based application, writes to
the console are not displayed and no exception is raised."

I hope this is of any help to you.

Regards,

Q

"John" <Jo************@AOL.net> wrote in message
news:uY**************@TK2MSFTNGP15.phx.gbl...
Hi there,

I've got a form with a listbox (lstWrkFiles) that populated with a number of files. I'm trying to pass this list of files to an array (so I can use it
later). However, I've the code below "Sub FileArray()" is meant to fire
when I click on the btnNext1 button, but nothing happens. Can anyone spot
what I'm doing wrong?

Thanks

John

Private Sub btnNext1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNext1.Click

'Populate Array

FileArray()

End Sub

Public Sub FileArray()

Dim List As New ArrayList

Dim filePath As String

For Each filePath In lstWrkFiles.Items

List.Add(filePath)

Next

Dim Item As String

For Each Item In List

Console.WriteLine(Item)

Next

Console.ReadLine()

End Sub

Nov 21 '05 #2
Q
Hey John,

I tried out your code and it seems to work correctly.
The output of your application goes to the debug-window.
I think your problem is the following:
I quote from MSDN help on "Console Class":

" The console class provides basic support for applications that read
characters from, and write characters to, the console.
If the console does not exist, as in a Windows-based application, writes to
the console are not displayed and no exception is raised."

I hope this is of any help to you.

Regards,

Q

"John" <Jo************@AOL.net> wrote in message
news:uY**************@TK2MSFTNGP15.phx.gbl...
Hi there,

I've got a form with a listbox (lstWrkFiles) that populated with a number of files. I'm trying to pass this list of files to an array (so I can use it
later). However, I've the code below "Sub FileArray()" is meant to fire
when I click on the btnNext1 button, but nothing happens. Can anyone spot
what I'm doing wrong?

Thanks

John

Private Sub btnNext1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNext1.Click

'Populate Array

FileArray()

End Sub

Public Sub FileArray()

Dim List As New ArrayList

Dim filePath As String

For Each filePath In lstWrkFiles.Items

List.Add(filePath)

Next

Dim Item As String

For Each Item In List

Console.WriteLine(Item)

Next

Console.ReadLine()

End Sub

Nov 21 '05 #3
Thanks for this Q. Does this mean that I can't use Console at all, or is
there some other way to implement it?

Thanks

John
"Q" <Q@nomail.be> wrote in message
news:e$**************@TK2MSFTNGP11.phx.gbl...
Hey John,

I tried out your code and it seems to work correctly.
The output of your application goes to the debug-window.
I think your problem is the following:
I quote from MSDN help on "Console Class":

" The console class provides basic support for applications that read
characters from, and write characters to, the console.
If the console does not exist, as in a Windows-based application, writes
to
the console are not displayed and no exception is raised."

I hope this is of any help to you.

Regards,

Q

"John" <Jo************@AOL.net> wrote in message
news:uY**************@TK2MSFTNGP15.phx.gbl...
Hi there,

I've got a form with a listbox (lstWrkFiles) that populated with a number

of
files. I'm trying to pass this list of files to an array (so I can use
it
later). However, I've the code below "Sub FileArray()" is meant to fire
when I click on the btnNext1 button, but nothing happens. Can anyone
spot
what I'm doing wrong?

Thanks

John

Private Sub btnNext1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNext1.Click

'Populate Array

FileArray()

End Sub

Public Sub FileArray()

Dim List As New ArrayList

Dim filePath As String

For Each filePath In lstWrkFiles.Items

List.Add(filePath)

Next

Dim Item As String

For Each Item In List

Console.WriteLine(Item)

Next

Console.ReadLine()

End Sub


Nov 21 '05 #4
Thanks for this Q. Does this mean that I can't use Console at all, or is
there some other way to implement it?

Thanks

John
"Q" <Q@nomail.be> wrote in message
news:e$**************@TK2MSFTNGP11.phx.gbl...
Hey John,

I tried out your code and it seems to work correctly.
The output of your application goes to the debug-window.
I think your problem is the following:
I quote from MSDN help on "Console Class":

" The console class provides basic support for applications that read
characters from, and write characters to, the console.
If the console does not exist, as in a Windows-based application, writes
to
the console are not displayed and no exception is raised."

I hope this is of any help to you.

Regards,

Q

"John" <Jo************@AOL.net> wrote in message
news:uY**************@TK2MSFTNGP15.phx.gbl...
Hi there,

I've got a form with a listbox (lstWrkFiles) that populated with a number

of
files. I'm trying to pass this list of files to an array (so I can use
it
later). However, I've the code below "Sub FileArray()" is meant to fire
when I click on the btnNext1 button, but nothing happens. Can anyone
spot
what I'm doing wrong?

Thanks

John

Private Sub btnNext1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnNext1.Click

'Populate Array

FileArray()

End Sub

Public Sub FileArray()

Dim List As New ArrayList

Dim filePath As String

For Each filePath In lstWrkFiles.Items

List.Add(filePath)

Next

Dim Item As String

For Each Item In List

Console.WriteLine(Item)

Next

Console.ReadLine()

End Sub


Nov 21 '05 #5

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

Similar topics

6
by: Deano | last post by:
I needed to have a listbox populated by locations which are stored in tblLocations. However I wanted an "All locations" entry to be at the top of the listbox. This is not in the tblLocations. The...
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...
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...
0
by: raypjr | last post by:
Hi everyone. I'm new here and hope I can get a little advice on how to list my array into a ListBox. I have my structure and array of structures. I need help with a For Loop that will list the...
2
by: raypjr | last post by:
Hi everyone. I'm new here and hope I can get a little advice on how to list my array into a ListBox. I have my structure and array of structures. I need help with a For Loop that will list the...
5
by: markr1000 | last post by:
I must have looked searched in 500+ places that showed up in Google searchs, but not one has an example of what I want to do. I have a Listbox on a User Control because I want to control the...
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...
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: 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...
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: 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...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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.