|
-
Dec 30th, 2000, 04:56 PM
#1
Thread Starter
Member
Hi, I have a DirListBox (the yellow folder thing on your tool box) and a textbox
so how do I copy line for line from the dirlistbox to the text box?
hope that was clear
Visual Programmer
VP/Sonic taking on the (vb) world, one post at a time.
-
Dec 30th, 2000, 05:28 PM
#2
Code:
Private Sub Command1_Click()
Dim iDir As Integer
For iDir = 0 To Dir1.ListCount - 1
Text1.Text = Text1.Text & Dir1.List(iDir) & vbCrLf
Next iDir
End Sub
-
Dec 30th, 2000, 05:40 PM
#3
Thread Starter
Member
thanks matthew, now how would I go about doing the same thing but for a file list, instead of the dir list
Visual Programmer
VP/Sonic taking on the (vb) world, one post at a time.
-
Dec 30th, 2000, 05:49 PM
#4
Same exact thing, just change Dir1 to File1 and iDir to iFile if you want.
Code:
Private Sub Command1_Click()
Dim iFile As Integer
For iFile = 0 To File1.ListCount - 1
Text1.Text = Text1.Text & File1.List(iFile) & vbCrLf
Next iFile
End Sub
-
Dec 30th, 2000, 05:52 PM
#5
Thread Starter
Member
Thanks once again.....
and 1 final question.....
is it possible to get rid of the extension?
VP/Sonic taking on the (vb) world, one post at a time.
-
Dec 30th, 2000, 06:01 PM
#6
To remove the file extension:
Code:
Private Sub Command1_Click()
Dim iFile As Integer
For iFile = 0 To File1.ListCount - 1
Text1.Text = Text1.Text & Left(File1.List(iFile), Len(File1.List(iFile)) - 4) & vbCrLf
Next iFile
End Sub
-
Dec 30th, 2000, 07:51 PM
#7
Frenzied Member
Matthew, not all extensions are 4 characters long (3 + . = 4 )
So use this API function to get rid of the extension:
Code:
Declare Sub PathRemoveExtension Lib "shlwapi.dll" Alias "PathRemoveExtensionA" (ByVal pszPath As String)
Private Sub GetRidOfExt_Click()
Dim Path$
Path = "c:\file.ext" 'fill the path into a string
PathRemoveExtension Path 'get the path without the ext.
MsgBox Path 'show the new path without ext.
End Sub
cool huh? : )
wheter your extension is .mp3 or .pl, it removes it
Jop - validweb.nl
Alcohol doesn't solve any problems, but then again, neither does milk.
-
Dec 30th, 2000, 09:44 PM
#8
Thread Starter
Member
Thanks 2 both
Visual Programmer
VP/Sonic taking on the (vb) world, one post at a time.
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
|