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

Help with a listbox

This code is supposed to open a specific file, in this case an MP3 file but then show it in a list box. But it isn't working!!

Private Sub btnAddFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddFile.Click

Dim OpenFile As New OpenFileDialog
Dim file As String

OpenFile.InitialDirectory = "C:\Documents and Settings\Matth\My Documents\test1\"
OpenFile.Filter = "MP3 Files (*.mp3)|*.MP3"
OpenFile.FilterIndex = 1
OpenFile.RestoreDirectory = True
OpenFile.Multiselect = True

If OpenFile.ShowDialog() = Windows.Forms.DialogResult.OK Then


For Each file In OpenFile.FileNames
ListBox.Items.Add(file)
Next
End
End If


Could someone help me with this problem please??
Nov 20 '07 #1
3 977
kadghar
1,295 Expert 1GB
have you tried:

openfile.show
or
openfile.visible = True

¿?

(dont remember which one works here)
Nov 20 '07 #2
Neither of those worked unfortunately.

'FileList.Items.Add(file)' is coming up as underlined and when I take it out, the files are opened but not shown in the list box
Nov 20 '07 #3
kadghar
1,295 Expert 1GB
Neither of those worked unfortunately.

'FileList.Items.Add(file)' is coming up as underlined and when I take it out, the files are opened but not shown in the list box
Sorry, i didnt see that, this might be of help:

OpenFile.Filter.add "MP3 Files (*.mp3)", "*.MP3"
Nov 20 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Vengeance | last post by:
On the parent_form.aspx I have these controls <asp:listbox id="Operators" runat="server" Width="163px" SelectionMode="Multiple" Rows="2"></asp:listbox> <INPUT class="loButton" onclick="java...
9
by: Megan | last post by:
Hi- I'm creating a database of music bands with their cds and songs. I'm trying to program an SQL statement so that I can enter a string of text in a textbox, press the 'Enter' key, and have...
7
by: Dave Hopper | last post by:
Hi I posted a question recently regarding problems I am having getting a value from a list box to use in a query. I got a lot of help, for which I thank you and it's nearly working! But I need...
3
by: Paul T. Rong | last post by:
I have a listbox (of product names) control on my form. I want to pass the selected item (a product name) to a subform, and the product unitprice should apear automatically next to the product name...
5
by: Melissa Cowan | last post by:
I am using Access 2000. I have the Developer's handbook and got the code for the mulit select listbox from there. It sends the selected value to another listbox, lstselected. What I need to do is...
0
by: David J | last post by:
Hi, I am strugling with the propertygrid and a listbox. I am using the universaldropdowneditor from the codeproject (code below). However I am populating the listbox via a datasource. The problem...
16
by: Allen | last post by:
I have a class that returns an arraylist. How do I fill a list box from what is returned? It returns customers which is a arraylist but I cant seem to get the stuff to fill a list box. I just...
15
by: deercreek | last post by:
I need some help figuring something out. I'm not sure if I heading in the correct direction. What I'm trying to accomplish is the following. I have a table that has id, discrip, and 2 date fields....
0
by: Alex | last post by:
Subject: Help with DoDragDrop event? From: Alex <me112006@test.com> Newsgroups: microsoft.public.dotnet.languages.csharp Hi all, I'm having a problem with drag/drop on listboxes... ...
2
by: Phijo | last post by:
Hello, I am writing a page (C#) that uses one ListBox that retrieves data from a DB using SqlDataSource and the SelectCommand. <asp:SqlDataSource ID="DataSource1" SelectCommandType=Text...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
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...
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.