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

Probably a lot of code

I have two columns in my listview, cName and cFile.
When the form loads, I want the cName column to show the
short filename of all files in the C:\Music directory
with a .mp3 and .wav extension. In the cFile column, I
want it to show the full filename of all files in the
C:\Music directory with a .mp3 or .wav extension. This
is probably a lot of code, but please don't get mad at me
I'm only 14 and just started programming. Thanks.
Nov 20 '05 #1
3 927
* "Bill English" <nu****@comcast.net> scripsit:
I have two columns in my listview, cName and cFile.
When the form loads, I want the cName column to show the
short filename of all files in the C:\Music directory
with a .mp3 and .wav extension. In the cFile column, I
want it to show the full filename of all files in the
C:\Music directory with a .mp3 or .wav extension. This
is probably a lot of code, but please don't get mad at me
I'm only 14 and just started programming. Thanks.


Have a look at 'Directory.GetFiles' and 'System.IO.Path.GetFileName'.
First, you determine all file names of the .mp3" files, then you loop
through the array of file names and add the items. You can get the file
name without the extension by calling 'Path.GetFileName'. Then you do
the same for the wave files.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #2
Thanks for the response, but how do I "determine mp3, and
loop", I am unfamiliar with both terms.
-----Original Message-----
* "Bill English" <nu****@comcast.net> scripsit:
I have two columns in my listview, cName and cFile.
When the form loads, I want the cName column to show the short filename of all files in the C:\Music directory
with a .mp3 and .wav extension. In the cFile column, I want it to show the full filename of all files in the
C:\Music directory with a .mp3 or .wav extension. This is probably a lot of code, but please don't get mad at me I'm only 14 and just started programming. Thanks.
Have a look at 'Directory.GetFiles'

and 'System.IO.Path.GetFileName'.First, you determine all file names of the .mp3" files, then you loopthrough the array of file names and add the items. You can get the filename without the extension by calling 'Path.GetFileName'. Then you dothe same for the wave files.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
.

Nov 20 '05 #3
Bill,

* "Bill English" <nu****@comcast.net> scripsit:
Thanks for the response, but how do I "determine mp3, and
loop", I am unfamiliar with both terms.


Untested (don't have .NET here):

\\\
Dim astrFiles() As String = Directory.GetFiles("C:\foo", "*.mp3")
Dim s As String
For Each s in astrFiles
...
Next s
///

If you have any further questions, feel free to ask them in this
thread. I don't want to send you the whole program because then the
learning effect will be 0%.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4

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

Similar topics

3
by: Nicke | last post by:
Hi, I've used vb.net for 3 hours(!) now and have probably a very easy question. In my VB6 programs I use For Each Cell in Range... very often which not seems to work in vb.net. Ex. Dim Cell...
4
by: Tomas Machala | last post by:
Hi, I'm trying to make an application communicating over TCP/IP. It should do only one thing - write received data to console and terminate itself when "exit" received. Problem is that if I send some...
7
by: Charles Sullivan | last post by:
On my system (using gcc) I found I need to use the "volatile" qualifier to limit compiler optimization. I notice that this qualifier is described in K&R 2nd edition (1988) but not in K&R 1st...
30
by: Brian Elmegaard | last post by:
Hi, I am struggling to understand how to really appreciate object orientation. I guess these are FAQ's but I have not been able to find the answers. Maybe my problem is that my style and...
7
by: Dustin MacDonald | last post by:
Hi everyone. This is my first time posting to this newsgroup, and although I maintain my netiquette I might've missed something specific to the newsgroup, so hopefully you can avoid flaming me...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.