|
-
Apr 15th, 2002, 12:44 AM
#1
Thread Starter
Fanatic Member
Why won't this work?
VB Code:
Private Sub Drive1_Change()
Dim x As Integer
Dim fname As String
If Drive1.Drive = "c:" Then
File1.Path = "c:\Mp3s"
Else
File1.Path = "d:\mp3s"
End If
For x = 0 To File1.ListCount - 1
fname = File1.Path & "\" & File1.List(x)
Set i = ListView1.ListItems.Add(, , File1.List(x))
i.SubItems(1) = File1.Path
DoEvents
Next
End If
End Sub
-
Apr 15th, 2002, 12:46 AM
#2
What are you trying to do?
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Apr 15th, 2002, 12:47 AM
#3
PowerPoster
what do you mean by "Why won't this work"? What exactly is not working?
-We have enough youth. How about a fountain of "Smart"?
-If you can read this, thank a teacher....and since it's in English, thank a soldier.

-
Apr 15th, 2002, 12:53 AM
#4
Thread Starter
Fanatic Member
ok...
When the user changes the drive letter in the drivelistbox, it checks to see which drive is selected. Then, it sets the filelistbox path based on which drive is selected, and adds all of the files and their paths to the listview
-
Apr 15th, 2002, 12:56 AM
#5
Re: ok...
Originally posted by hipopony66
When the user changes the drive letter in the drivelistbox, it checks to see which drive is selected. Then, it sets the filelistbox path based on which drive is selected, and adds all of the files and their paths to the listview
Is that for the folder that the user chooses?
when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
https://get.cryptobrowser.site/30/4111672
-
Apr 15th, 2002, 12:57 AM
#6
Try:
VB Code:
i.ListSubItems.Add , , File1.Path
-
Apr 15th, 2002, 01:02 AM
#7
And I think that last End IF should go.
-
Apr 15th, 2002, 01:08 AM
#8
hipopony66,
In any event I think u have a few things back-to-front.
I'm just trying to sort them out now
-
Apr 15th, 2002, 01:18 AM
#9
Thread Starter
Fanatic Member
Ok, here's problem
It never finds the drive1.drive ="c:\"
Even though the C: drive is selected. What could cause this?
does the drive label have to be included? and if so, how come you can set the default drive by putting in form load event
drive1.drive= "d:\"?
-
Apr 15th, 2002, 01:27 AM
#10
Here u go:
VB Code:
Private Sub Drive1_Change()
Dim fname As String
Dim x As Integer
If Left$(Drive1.Drive, 2) = "c:" Then 'Change here
File1.Path = "c:\Mp3s"
Else
File1.Path = "d:\Mp3s"
End If
With ListView1 'Added this
.ColumnHeaders.Clear
.View = lvwReport
.ColumnHeaders.Add , , "Path", 1000, 0
.ColumnHeaders.Add , , "Song Title", 2000, 0
End With
For x = 0 To File1.ListCount - 1 'Changes made here
fname = File1.Path & "\" & File1.List(x)
Set i = ListView1.ListItems.Add(, , fname)
i.ListSubItems.Add , , File1.List(x)
Next
End Sub
The C: wasn't found cause .Drive = "C: [Drive Name]"
-
Apr 15th, 2002, 01:39 AM
#11
PowerPoster
This here seems to work...
VB Code:
Private Sub Drive1_Change()
Dim x As Integer
Dim fname As String
If Drive1.Drive = "c:" Then
File1.Path = "c:\Mp3's"
Else
File1.Path = "d:\mp3s"
End If
For x = 0 To File1.ListCount - 1
Label1 = File1.Path & "\" & File1.List(x)
Set i = ListView1.ListItems.Add(, , File1.List(x))
Next
End Sub
-We have enough youth. How about a fountain of "Smart"?
-If you can read this, thank a teacher....and since it's in English, thank a soldier.

-
Apr 15th, 2002, 01:52 AM
#12
After a few slight changes, ie fname isn't required.
VB Code:
Option Explicit
Private Sub Drive1_Change()
Dim x As Integer
Dim i As ListItem 'Added this
If Left$(Drive1.Drive, 2) = "c:" Then 'Change here
File1.Path = "c:"
Else
File1.Path = "d:"
End If
With ListView1 'Added this
.ColumnHeaders.Clear
.View = lvwReport
.ColumnHeaders.Add , , "Path", 1000, 0
.ColumnHeaders.Add , , "Song Title", 2000, 0
End With
For x = 0 To File1.ListCount - 1 'Changes made here
Set i = ListView1.ListItems.Add(, , File1.Path) 'Replaced fname
i.ListSubItems.Add , , File1.List(x)
Next
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|