473,544 Members | 1,778 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 1744
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
3092
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
3596
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
2860
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...
7
4521
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...
3
2275
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
1404
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
4198
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
2535
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...
1
1676
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...
6
16997
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...
0
7414
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...
0
7359
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7699
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5895
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5288
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...
0
4905
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...
0
3398
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1833
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
0
651
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...

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.