Sep 20th, 2001, 12:08 AM
#1
Thread Starter
Frenzied Member
Please Help
how would i make a file name show up in a textbox and it u clicked it it would go to the file like if i wanted to copy it to a dif dir
Sep 20th, 2001, 12:26 AM
#2
Addicted Member
what're the variables?
Do you know the location of the file?
If so, just do this: Text1.text = "C:\YourFile"
If you don't know, use a common dialog box control
and to copy, use the FileCopy function.
Sep 20th, 2001, 01:05 AM
#3
Thread Starter
Frenzied Member
how would i load all the file names in a 1 dir.....beacause all urs does is make text show up
Sep 20th, 2001, 01:36 AM
#4
Thread Starter
Frenzied Member
HEEEEEEEEEEEEEEEEEEEEEELLLLLLLLLLLLLLLLLLLLLLPPP!!!!!!!!!!!!!!!
Sep 20th, 2001, 02:28 AM
#5
Thread Starter
Frenzied Member
Sep 20th, 2001, 02:28 AM
#6
-= B u g S l a y e r =-
Why not use a FileListBox ?
It will show u all files in a given folder, and that is what u want ? or?
Sep 20th, 2001, 02:30 AM
#7
Thread Starter
Frenzied Member
no not like that i mean get all the files to show up in a textbox and be able to select amy1 of thos files and copy r delete it
Sep 20th, 2001, 02:33 AM
#8
-= B u g S l a y e r =-
well u should not use a textbox.
use a listbox
Sep 20th, 2001, 02:35 AM
#9
-= B u g S l a y e r =-
try this
VB Code:
Option Explicit
Private Declare Function SendMessageStr Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As String) As Long
Private Const LB_DIR = &H18D
Private Const DDL_READWRITE = &H0
Private Const DDL_READONLY = &H1
Private Const DDL_HIDDEN = &H2
Private Const DDL_SYSTEM = &H4
Private Const DDL_DIRECTORY = &H10
Private Const DDL_ARCHIVE = &H20
Private Const DDL_DRIVES = &H4000
Private Const DDL_EXCLUSIVE = &H8000
Private Const DDL_POSTMSGS = &H2000
Private Const DDL_FLAGS = DDL_ARCHIVE Or DDL_DIRECTORY Or DDL_HIDDEN Or DDL_SYSTEM
Private Sub Command1_Click()
Dim r As Long
r = SendMessageStr(List1.hwnd, LB_DIR, DDL_FLAGS, "C:\*.*")
End Sub
Private Sub List1_Click()
MsgBox List1.Text
End Sub
Sep 20th, 2001, 03:04 AM
#10
Thread Starter
Frenzied Member
code dont work and i mean i dont want a list box look ill c if i can explain it to u a little better
ok u have a textbox right? and now all i want to do is load the fille names in from a folder.. say i put my exe in the folder and wanted to load all the file names in that folder into the textbox in my exe. i wanted it to be where i could click the load button my my exe and it would load all the file names in that folder in the textbox in my exe.,, then i would be able to select any 1 of thos file names and copy it to another dir or delete it all together.......if u still dont get it tll em
or maybe i should u a lable insted of a text box
thx
Last edited by Motoxpro; Sep 20th, 2001 at 03:07 AM .
Sep 20th, 2001, 03:30 AM
#11
Thread Starter
Frenzied Member
Last edited by Motoxpro; Sep 20th, 2001 at 03:46 AM .
Sep 20th, 2001, 03:34 AM
#12
-= B u g S l a y e r =-
Ok, still not sure I understand,(I'm a bit slow )
This will add all files found in a given folder to a textbox
VB Code:
Private Sub Command1_Click()
Dim sFile As String
Dim s As String
sFile = Dir(App.Path & "\")
Do While sFile <> ""
s = s & sFile & vbCrLf
sFile = Dir
Loop
Text1.Text = s
End Sub
make sure that the textbox multiline prop is sat to true
is that how u want it?
Sep 20th, 2001, 03:40 AM
#13
-= B u g S l a y e r =-
hmm... the picture is not shown ?
Sep 20th, 2001, 03:45 AM
#14
Thread Starter
Frenzied Member
ok thats is....but can i do that with a label and can u make it where it would be like
filename.*
filename.*
filename.*
u c what i am saying and could u make it where i could click on the filename and be able to delete it and copy it
and i think i will make that textbox in the pic a label
Attached Images
Last edited by Motoxpro; Sep 20th, 2001 at 03:51 AM .
Sep 20th, 2001, 04:08 AM
#15
Thread Starter
Frenzied Member
OPPPPPPPS i was supsed to use lstbox sry man i think i found some code:
Use a listbox and fill it on form load:
Private Sub Form_Load()
Dim strfile As String
strfile = Dir$("C:\My Documents\*.*")
Do While strfile <> ""
List1.AddItem strfile
strfile = Dir$()
Loop
End Sub
To use the files, select from the listbox
Private Sub List1_Click()
Dim strfile As String
strfile = List1.Text
' to delete
Kill (strfile)
'to copy
'You will need to supply the path
FileCopy strfile, "Copy of " & strFile
End Sub
Sep 20th, 2001, 04:20 AM
#16
-= B u g S l a y e r =-
heh glad u realized
the sample I posted earlier will aslo do the trick
VB Code:
Option Explicit
Private Declare Function SendMessageStr Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As String) As Long
Private Const LB_DIR = &H18D
Private Const DDL_READWRITE = &H0
Private Const DDL_READONLY = &H1
Private Const DDL_HIDDEN = &H2
Private Const DDL_SYSTEM = &H4
Private Const DDL_DIRECTORY = &H10
Private Const DDL_ARCHIVE = &H20
Private Const DDL_DRIVES = &H4000
Private Const DDL_EXCLUSIVE = &H8000
Private Const DDL_POSTMSGS = &H2000
Private Const DDL_FLAGS = DDL_ARCHIVE Or DDL_DIRECTORY Or DDL_HIDDEN Or DDL_SYSTEM
Private Sub Command1_Click()
Dim r As Long
r = SendMessageStr(List1.hwnd, LB_DIR, DDL_FLAGS, "C:\*.*")
End Sub
Private Sub List1_Click()
MsgBox List1.Text
End Sub
u said it didn't work, but it does. U must have done something wrong
Sep 20th, 2001, 04:40 AM
#17
Thread Starter
Frenzied Member
where do i post the top part of u code?
Sep 20th, 2001, 05:31 AM
#18
-= B u g S l a y e r =-
U should put it in the General Declarations area of u'r form
ie at the top in the code view of a form.
or u can declare it as public and place it in a module
Sep 20th, 2001, 12:54 PM
#19
Thread Starter
Frenzied Member
awwww man that code is GREAT just what i needed now all i have to do is figure out how to make it like if i select a file in there i would be able to copy it
Sep 20th, 2001, 03:28 PM
#20
-= B u g S l a y e r =-
VB Code:
Option Explicit
Private Declare Function SendMessageStr Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As String) As Long
Private Const LB_DIR = &H18D
Private Const DDL_READWRITE = &H0
Private Const DDL_READONLY = &H1
Private Const DDL_HIDDEN = &H2
Private Const DDL_SYSTEM = &H4
Private Const DDL_DIRECTORY = &H10
Private Const DDL_ARCHIVE = &H20
Private Const DDL_DRIVES = &H4000
Private Const DDL_EXCLUSIVE = &H8000
Private Const DDL_POSTMSGS = &H2000
Private Const DDL_FLAGS = DDL_ARCHIVE Or DDL_DIRECTORY Or DDL_HIDDEN Or DDL_SYSTEM
Private sFileToCopy As String
Private sPath As String
Private Sub Command1_Click()
Dim r As Long
sPath = "C:\DATA\DOCS\"
r = SendMessageStr(List1.hwnd, LB_DIR, DDL_FLAGS, sPath & "*.DOC")
End Sub
Private Sub Command2_Click()
'copy the file :)
FileCopy sPath & List1.Text, "C:\TMP\" & List1.Text
End Sub
Sep 20th, 2001, 10:21 PM
#21
Thread Starter
Frenzied Member
i cant get that 1 to work says path not foun even if i put like FileCopy sPath & List1.Text, "C:\" & List1.Text like that
Sep 21st, 2001, 12:25 AM
#22
Thread Starter
Frenzied Member
Sep 21st, 2001, 02:01 AM
#23
Thread Starter
Frenzied Member
Sep 21st, 2001, 02:35 AM
#24
Thread Starter
Frenzied Member
nm i was tryin to copy b4 i loaaded the files in silly me but now when i try to load the files in nothing shows up in the list box
Sep 21st, 2001, 02:38 AM
#25
-= B u g S l a y e r =-
send me the code, and I'll have a look or just upload the code here
Sep 21st, 2001, 02:52 AM
#26
Thread Starter
Frenzied Member
ok i got every thing working now hust to add the fiishing tuches.......how would i make it where u could find ur own dir to load the files from.....beacuase the peeps m giving it to arnt gunna have the code and how would i make it cut instead of copy and how would i make it where u ould select 1 of thos files and delete it thx man if u answer thse this all the questions i have for this prograam thx
Sep 21st, 2001, 03:36 AM
#27
Thread Starter
Frenzied Member
VB Code:
Option Explicit
Private Declare Function SendMessageStr Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As String) As Long
Private Const LB_DIR = &H18D
Private Const DDL_READWRITE = &H0
Private Const DDL_READONLY = &H1
Private Const DDL_HIDDEN = &H2
Private Const DDL_SYSTEM = &H4
Private Const DDL_DIRECTORY = &H10
Private Const DDL_ARCHIVE = &H20
Private Const DDL_DRIVES = &H4000
Private Const DDL_EXCLUSIVE = &H8000
Private Const DDL_POSTMSGS = &H2000
Private Const DDL_FLAGS = DDL_ARCHIVE Or DDL_DIRECTORY Or DDL_HIDDEN Or DDL_SYSTEM
Private sFileToCopy As String
Private sPath As String
Private Sub Check1_Click()
End Sub
Private Sub Check2_Click()
End Sub
Private Sub Command1_Click()
'copy the file
FileCopy "C:\Program Files\Mx Track Pro\Unloaded\" & List1.Text, "D:\MCM2\TERAFORM\NATIONAL\" & List1.Text
End Sub
Private Sub Command2_Click()
Dim r As Long
sPath = "D:\MCM2\TERAFORM\NATIONAL\"
r = SendMessageStr(List1.hwnd, LB_DIR, DDL_FLAGS, sPath & "*.env")
End Sub
Private Sub Command3_Click()
End Sub
Private Sub Command4_Click()
'copy the file
FileCopy sPath & List1.Text, "C:\Program Files\Mx Track Pro\Unloaded\" & List1.Text
End Sub
Private Sub Command5_Click()
End Sub
Private Sub Command6_Click()
FileLen ("C:\Program Files\Mx Track Pro\Unloaded\1tall.env")
End Sub
Private Sub Command7_Click()
Unload Me
End Sub
Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)
End Sub
Private Sub List1_Click()
End Sub
that is the whole program......still debugging a little
Last edited by Motoxpro; Sep 22nd, 2001 at 12:12 AM .
Sep 21st, 2001, 11:52 AM
#28
Thread Starter
Frenzied Member
Last edited by Motoxpro; Sep 21st, 2001 at 05:33 PM .
Sep 21st, 2001, 05:34 PM
#29
Thread Starter
Frenzied Member
oppss i pushed submit....but is that what u want
Sep 21st, 2001, 06:34 PM
#30
Thread Starter
Frenzied Member
Sep 21st, 2001, 06:42 PM
#31
New Member
Originally posted by Motoxpro
how would i load all the file names in a 1 dir.....beacause all urs does is make text show up
Use chdir to change your current directory to the directory you want to search for.
Than call dir("*.*") for searching files, it will return the first file name under current dir, and you can call it continue with no parameters for getting next filename.
Sep 21st, 2001, 06:52 PM
#32
Thread Starter
Frenzied Member
have u read the post i aready got all the code for that
Sep 21st, 2001, 09:49 PM
#33
Thread Starter
Frenzied Member
peet u there man......been 2 days
Sep 22nd, 2001, 06:46 AM
#34
-= B u g S l a y e r =-
jepp ... I'm here, how far in u'r dev. are u now?
Sep 22nd, 2001, 02:03 PM
#35
Thread Starter
Frenzied Member
well im pretty much done now but i did the layout a little difernt and i make a text box and a button so u could just type in the right dir there.......only thing now is how to get it to reset like if i try to load 2 dirs the 2nd 1 i load will be right after the first 1 and i want it to reset.......and.....how would imake check boxes acualy work
Sep 23rd, 2001, 12:39 AM
#36
Thread Starter
Frenzied Member
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