473,708 Members | 2,415 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Directories and Listbox

26 New Member
I want to be able to have someone click a command button, then have a directory form show, that part is complete. Now i need help adding all the files in this directory to a list with the extensions ".mp3, .wav, and .mid". this is what i have so far.

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdAddDir_Click()
  2. Dim di As New IO
  3. .DirectoryInfo ("c:\")
  4. Dim diar1 As IO
  5. .FileInfo() = di.GetFiles("*.mp3", "*.wav", "*.mid")
  6. Dim dra As IO.FileInfo
  7. For Each dra In diar1
  8.     lstSongs.Items.Add (dra)
  9. Next
  10. End Sub
any hints or tips would be appreciated

-Jacob
Aug 21 '07 #1
11 1755
Killer42
8,435 Recognized Expert Expert
You've told us what you're doing. Can you tell us what your problem is?
Aug 21 '07 #2
jacobevans
26 New Member
You've told us what you're doing. Can you tell us what your problem is?

haha sorry about that.

i get a compile error, user-defined type not defined

is there any easier way to do what im doing?
Aug 21 '07 #3
hariharanmca
1,977 Top Contributor
haha sorry about that.

i get a compile error, user-defined type not defined

is there any easier way to do what im doing?
user-defined type not defined

It comes missing some references. I think you didn't reffer FSO.

can you post which version?
Aug 21 '07 #4
ngchaitra
16 New Member
I am working in asp.net 2.0 and using vb script.
Aug 21 '07 #5
hariharanmca
1,977 Top Contributor
I am working in asp.net 2.0 and using vb script.
Debug and just point which piece of code throwing this error.

(I think, this error will come at build time)

Just check all reference are there
Aug 21 '07 #6
Killer42
8,435 Recognized Expert Expert
Debug and just point which piece of code throwing this error.

(I think, this error will come at build time)

Just check all reference are there
I'm not sure VBScript has any concept of "build time" - isn't it interpreted at runtime?

But I agree, we need to know which statement/reference is throwing the error.
Aug 21 '07 #7
jacobevans
26 New Member
Dim di As New IO
is where its erroring

im not sure what you mean by version but im running VB6 32 bit
Aug 21 '07 #8
Killer42
8,435 Recognized Expert Expert
Dim di As New IO
is where its erroring

im not sure what you mean by version but im running VB6 32 bit
I use VB6, and I'm not aware of any object type of IO. In fact I've just tested and got the same error. Either you've got the type (IO) wrong, or you need to add a reference to the library that contains it.

Also, we need to sort something out. Are you using VBScript or VB? They are quite similar, but not the same thing.
Aug 21 '07 #9
jacobevans
26 New Member
Im for sures using visual basic 6.0
Aug 21 '07 #10

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

Similar topics

17
3122
by: amber | last post by:
Hello. Can someone tell me what I may be doing wrong here? I'm using the code (lboxRP is a listbox): Dim newRPindex As Integer newRPindex = Me.lboxRP.FindString(RP) Me.lboxRP.SetSelected(newRPindex, True) When the last line executes, I get an error message:
3
3613
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 in the subform. Is it possible? How do I do this? Thanks in advance. Paul from Slovakia
6
2876
by: Chris Leuty | last post by:
I am populating a multiselect Listbox from a dataset, with the content of the listbox filled by one table, and the selections determined from another table. So far, I have been keeping the dataset a denormalized mirror of the database, but I'm not having much luck getting the selection logic down (I haven't found a 'hook' where I can access the listbox object as an object to set the listitem's selected property before it gets rendered).. ...
7
4531
by: Dave | last post by:
Hi all, After unsuccessfully trying to make my own dual listbox control out of arraylists, I decided to look for a 3rd party control. I've looked for over a week now and can't find anything but ASP.Net stuff when I need a Windows Form control. I've seen dual listbox populators in countless Windows applications, and have seen them run very fast, so I figured this would be extremely popular. Here's how it should work:
3
2294
by: Ali Chambers | last post by:
Hi, I have created a listbox called "dtlist1" on my VB.NET form. I call a procedure as follows: Private Sub openfile(flname As String) dtlist1.Items.Clear() etc..
2
1408
by: JIM.H. | last post by:
private void getList() { string fList = Directory.GetFiles("c:\\Tmp"); listBox.DataSource = fList; listBox.DataBind(); } This codes brings all the files in the folder c:\tmp. How can make this code return all the files in the sub directories too?
4
4231
by: rn5a | last post by:
I have a ListBox which should list all the files & directories that exist in a particular directory. The problem is I can get the ListBox to list either all the files or all the directories but not the 2 of them together. This is what I tried: Sub Page_Load(.....) Dim dInfo As DirectoryInfo dInfo = New DirectoryInfo(Server.MapPath(MyDir))
3
2554
by: rn5a | last post by:
I am not very sure whether I should have continued with my earlier thread or started a new thread whose subject matter was somewhat similar to the subject matter in this thread. Anyway after much deliberation, I decided to start a new thread. So here it is. Pardon me if I should have continued with my earlier thread instead of starting this new thread. A ListBox lists all the directories & files existing in a directory on the server....
1
1690
by: rn5a | last post by:
A ListBox lists all the folders & files existing in a directory named 'MyDir' on the server. Assume that the ListBox lists 2 directories - 'Dir1' & 'Dir2' i.e. these 2 directories reside in the 'MyDir' directory. Both 'Dir1' & 'Dir2' also house sub-directories & files. Assume that the sub-directory 'Dir1' has 3 directories & 3 files. When a user comes to a ASPX page for the first time, the ListBox lists all the directories & files...
6
17017
by: =?Utf-8?B?WW9naSBXYXRjaGVy?= | last post by:
Hello, I am using Visual Studio-2003. I created a project to build my library. Since I am using third party libraries as well, I have specified those additional library dependencies in project as "Additional Dependencies" under Linker-Input options. Since those libraries are also in different directory, I specified that library path in project as "Additional Library Directories" under Linker-General options. This is where I see some...
0
8788
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9159
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9061
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6615
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5939
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4713
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3151
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2508
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2097
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.