Results 1 to 36 of 36

Thread: Please Help

  1. #1

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211

    Question 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

  2. #2
    Addicted Member jestes's Avatar
    Join Date
    Jan 2001
    Location
    Dallas
    Posts
    248

    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.

  3. #3

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    how would i load all the file names in a 1 dir.....beacause all urs does is make text show up

  4. #4

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    HEEEEEEEEEEEEEEEEEEEEEELLLLLLLLLLLLLLLLLLLLLLPPP!!!!!!!!!!!!!!!

  5. #5

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    HELP!!!!!!!!!!!

  6. #6
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    Why not use a FileListBox ?

    It will show u all files in a given folder, and that is what u want ? or?
    -= a peet post =-

  7. #7

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    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

  8. #8
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    well u should not use a textbox.
    use a listbox
    -= a peet post =-

  9. #9
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    try this

    VB Code:
    1. Option Explicit
    2. Private Declare Function SendMessageStr Lib "user32" Alias "SendMessageA" _
    3.     (ByVal hwnd As Long, _
    4.     ByVal wMsg As Long, _
    5.     ByVal wParam As Long, _
    6.     ByVal lParam As String) As Long
    7.     Private Const LB_DIR = &H18D
    8.     Private Const DDL_READWRITE = &H0
    9.     Private Const DDL_READONLY = &H1
    10.     Private Const DDL_HIDDEN = &H2
    11.     Private Const DDL_SYSTEM = &H4
    12.     Private Const DDL_DIRECTORY = &H10
    13.     Private Const DDL_ARCHIVE = &H20
    14.     Private Const DDL_DRIVES = &H4000
    15.     Private Const DDL_EXCLUSIVE = &H8000
    16.     Private Const DDL_POSTMSGS = &H2000
    17.     Private Const DDL_FLAGS = DDL_ARCHIVE Or DDL_DIRECTORY Or DDL_HIDDEN Or DDL_SYSTEM
    18.  
    19.  
    20. Private Sub Command1_Click()
    21.     Dim r As Long
    22.     r = SendMessageStr(List1.hwnd, LB_DIR, DDL_FLAGS, "C:\*.*")
    23. End Sub
    24.  
    25. Private Sub List1_Click()
    26.     MsgBox List1.Text
    27. End Sub
    -= a peet post =-

  10. #10

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    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.

  11. #11

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    Last edited by Motoxpro; Sep 20th, 2001 at 03:46 AM.

  12. #12
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    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:
    1. Private Sub Command1_Click()
    2.     Dim sFile As String
    3.     Dim s As String
    4.     sFile = Dir(App.Path & "\")
    5.     Do While sFile <> ""
    6.         s = s & sFile & vbCrLf
    7.         sFile = Dir
    8.     Loop
    9.     Text1.Text = s
    10. End Sub

    make sure that the textbox multiline prop is sat to true

    is that how u want it?
    -= a peet post =-

  13. #13
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    hmm... the picture is not shown ?
    -= a peet post =-

  14. #14

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    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 Attached Images  
    Last edited by Motoxpro; Sep 20th, 2001 at 03:51 AM.

  15. #15

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211

    Talking

    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

  16. #16
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    heh glad u realized

    the sample I posted earlier will aslo do the trick

    VB Code:
    1. Option Explicit
    2. Private Declare Function SendMessageStr Lib "user32" Alias "SendMessageA" _
    3.     (ByVal hwnd As Long, _
    4.     ByVal wMsg As Long, _
    5.     ByVal wParam As Long, _
    6.     ByVal lParam As String) As Long
    7.     Private Const LB_DIR = &H18D
    8.     Private Const DDL_READWRITE = &H0
    9.     Private Const DDL_READONLY = &H1
    10.     Private Const DDL_HIDDEN = &H2
    11.     Private Const DDL_SYSTEM = &H4
    12.     Private Const DDL_DIRECTORY = &H10
    13.     Private Const DDL_ARCHIVE = &H20
    14.     Private Const DDL_DRIVES = &H4000
    15.     Private Const DDL_EXCLUSIVE = &H8000
    16.     Private Const DDL_POSTMSGS = &H2000
    17.     Private Const DDL_FLAGS = DDL_ARCHIVE Or DDL_DIRECTORY Or DDL_HIDDEN Or DDL_SYSTEM
    18.  
    19.  
    20. Private Sub Command1_Click()
    21.     Dim r As Long
    22.     r = SendMessageStr(List1.hwnd, LB_DIR, DDL_FLAGS, "C:\*.*")
    23. End Sub
    24.  
    25. Private Sub List1_Click()
    26.     MsgBox List1.Text
    27. End Sub
    u said it didn't work, but it does. U must have done something wrong
    -= a peet post =-

  17. #17

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    where do i post the top part of u code?

  18. #18
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    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
    -= a peet post =-

  19. #19

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    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

  20. #20
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    VB Code:
    1. Option Explicit
    2. Private Declare Function SendMessageStr Lib "user32" Alias "SendMessageA" _
    3.     (ByVal hwnd As Long, _
    4.     ByVal wMsg As Long, _
    5.     ByVal wParam As Long, _
    6.     ByVal lParam As String) As Long
    7.     Private Const LB_DIR = &H18D
    8.     Private Const DDL_READWRITE = &H0
    9.     Private Const DDL_READONLY = &H1
    10.     Private Const DDL_HIDDEN = &H2
    11.     Private Const DDL_SYSTEM = &H4
    12.     Private Const DDL_DIRECTORY = &H10
    13.     Private Const DDL_ARCHIVE = &H20
    14.     Private Const DDL_DRIVES = &H4000
    15.     Private Const DDL_EXCLUSIVE = &H8000
    16.     Private Const DDL_POSTMSGS = &H2000
    17.     Private Const DDL_FLAGS = DDL_ARCHIVE Or DDL_DIRECTORY Or DDL_HIDDEN Or DDL_SYSTEM
    18.  
    19. Private sFileToCopy As String
    20. Private sPath As String
    21.  
    22. Private Sub Command1_Click()
    23.     Dim r As Long
    24.     sPath = "C:\DATA\DOCS\"
    25.     r = SendMessageStr(List1.hwnd, LB_DIR, DDL_FLAGS, sPath & "*.DOC")
    26. End Sub
    27.  
    28. Private Sub Command2_Click()
    29.     'copy the file :)
    30.     FileCopy sPath & List1.Text, "C:\TMP\" & List1.Text
    31. End Sub
    -= a peet post =-

  21. #21

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    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

  22. #22

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    peet u there?

  23. #23

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    C:\

  24. #24

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    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

  25. #25
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    send me the code, and I'll have a look or just upload the code here
    -= a peet post =-

  26. #26

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    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

  27. #27

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    VB Code:
    1. Option Explicit
    2. Private Declare Function SendMessageStr Lib "user32" Alias "SendMessageA" _
    3.     (ByVal hwnd As Long, _
    4.     ByVal wMsg As Long, _
    5.     ByVal wParam As Long, _
    6.     ByVal lParam As String) As Long
    7.     Private Const LB_DIR = &H18D
    8.     Private Const DDL_READWRITE = &H0
    9.     Private Const DDL_READONLY = &H1
    10.     Private Const DDL_HIDDEN = &H2
    11.     Private Const DDL_SYSTEM = &H4
    12.     Private Const DDL_DIRECTORY = &H10
    13.     Private Const DDL_ARCHIVE = &H20
    14.     Private Const DDL_DRIVES = &H4000
    15.     Private Const DDL_EXCLUSIVE = &H8000
    16.     Private Const DDL_POSTMSGS = &H2000
    17.     Private Const DDL_FLAGS = DDL_ARCHIVE Or DDL_DIRECTORY Or DDL_HIDDEN Or DDL_SYSTEM
    18.  
    19. Private sFileToCopy As String
    20. Private sPath As String
    21.  
    22. Private Sub Check1_Click()
    23.  
    24. End Sub
    25.  
    26. Private Sub Check2_Click()
    27.  
    28. End Sub
    29.  
    30. Private Sub Command1_Click()
    31.    'copy the file
    32.     FileCopy "C:\Program Files\Mx Track Pro\Unloaded\" & List1.Text, "D:\MCM2\TERAFORM\NATIONAL\" & List1.Text
    33. End Sub
    34.  
    35. Private Sub Command2_Click()
    36.     Dim r As Long
    37.     sPath = "D:\MCM2\TERAFORM\NATIONAL\"
    38.     r = SendMessageStr(List1.hwnd, LB_DIR, DDL_FLAGS, sPath & "*.env")
    39. End Sub
    40.  
    41.  
    42. Private Sub Command3_Click()
    43.  
    44. End Sub
    45.  
    46. Private Sub Command4_Click()
    47. 'copy the file
    48. FileCopy sPath & List1.Text, "C:\Program Files\Mx Track Pro\Unloaded\" & List1.Text
    49. End Sub
    50.  
    51. Private Sub Command5_Click()
    52.  
    53. End Sub
    54.  
    55. Private Sub Command6_Click()
    56. FileLen ("C:\Program Files\Mx Track Pro\Unloaded\1tall.env")
    57. End Sub
    58.  
    59. Private Sub Command7_Click()
    60.  
    61. Unload Me
    62.  
    63. End Sub
    64.  
    65. Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)
    66.  
    67. End Sub
    68.  
    69. Private Sub List1_Click()
    70.  
    71. End Sub




    that is the whole program......still debugging a little
    Last edited by Motoxpro; Sep 22nd, 2001 at 12:12 AM.

  28. #28

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    i
    Last edited by Motoxpro; Sep 21st, 2001 at 05:33 PM.

  29. #29

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    oppss i pushed submit....but is that what u want

  30. #30

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    peet u there??

  31. #31
    New Member
    Join Date
    Sep 2001
    Location
    Shanghai
    Posts
    1
    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.

  32. #32

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    have u read the post i aready got all the code for that

  33. #33

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    peet u there man......been 2 days

  34. #34
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    jepp ... I'm here, how far in u'r dev. are u now?
    -= a peet post =-

  35. #35

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    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

  36. #36

    Thread Starter
    Frenzied Member Motoxpro's Avatar
    Join Date
    Sep 2001
    Location
    Spiro, OK
    Posts
    1,211
    because i got most all the stuff working and everey thing just need to add the finishing tuches like i said

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width