I need help, badly!! - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

I need help, badly!!

compuwizjrcompuwizjr Posts: 73Member
I'm working on a personalized wipe-out disk for a friend, but I can't figure out how to make it delete the file the person specifies. You see, I have a text box(txtFile) where the user will type in the name of the file, a text box(txtSource) where the user will type in the location of the file, then the start button(txtDelete), but my problem is that I don't know the code to delete the file specified in the "txtFile" box. Can some one help me?

Comments

  • dirtyharrydirtyharry Posts: 8Member
    : I'm working on a personalized wipe-out disk for a friend, but I can't figure out how to make it delete the file the person specifies. You see, I have a text box(txtFile) where the user will type in the name of the file, a text box(txtSource) where the user will type in the location of the file, then the start button(txtDelete), but my problem is that I don't know the code to delete the file specified in the "txtFile" box. Can some one help me?
    :

    I think there is a command 'kill' which can remove files.
    Example: Kill ("c: emp est.txt")
    So in your case : Kill (txtSource.Text & txtFile.Text)

    To remove directories use: rmdir
    Example: Rmdir ("c: emp")
    Note that the last function only works if ALL files AND folders are removed in that folder so the folder is empty.

    Good luck!
    Marty
  • compuwizjrcompuwizjr Posts: 73Member
    : : I'm working on a personalized wipe-out disk for a friend, but I can't figure out how to make it delete the file the person specifies. You see, I have a text box(txtFile) where the user will type in the name of the file, a text box(txtSource) where the user will type in the location of the file, then the start button(txtDelete), but my problem is that I don't know the code to delete the file specified in the "txtFile" box. Can some one help me?
    : :
    :
    : I think there is a command 'kill' which can remove files.
    : Example: Kill ("c: emp est.txt")
    : So in your case : Kill (txtSource.Text & txtFile.Text)
    :
    : To remove directories use: rmdir
    : Example: Rmdir ("c: emp")
    : Note that the last function only works if ALL files AND folders are removed in that folder so the folder is empty.
    :
    : Good luck!
    : Marty
    :
    : Thanks for your help, but now I have another problem. I also have "Cancel" button, and I can't figure out what kind of code to use for the button to make the delete action stop.


  • dirtyharrydirtyharry Posts: 8Member
    : : : I'm working on a personalized wipe-out disk for a friend, but I can't figure out how to make it delete the file the person specifies. You see, I have a text box(txtFile) where the user will type in the name of the file, a text box(txtSource) where the user will type in the location of the file, then the start button(txtDelete), but my problem is that I don't know the code to delete the file specified in the "txtFile" box. Can some one help me?
    : : :
    : :
    : : I think there is a command 'kill' which can remove files.
    : : Example: Kill ("c: emp est.txt")
    : : So in your case : Kill (txtSource.Text & txtFile.Text)
    : :
    : : To remove directories use: rmdir
    : : Example: Rmdir ("c: emp")
    : : Note that the last function only works if ALL files AND folders are removed in that folder so the folder is empty.
    : :
    : : Good luck!
    : : Marty
    : :
    : : Thanks for your help, but now I have another problem. I also have "Cancel" button, and I can't figure out what kind of code to use for the button to make the delete action stop.
    :
    :
    :

    Well you can't really stop one Kill command. What you can do is stop a loop in which more files are deleted.
    For example if you delete 100 files in a directory using a while loop, create a public boolean continue which is set on true initially. I you press cancel this boolean will be set to false so that the loop won't continue.

    Example:
    general
    public continue as boolean
    -----
    public sub deleteFiles ()
    continue = true
    While i < numberOfFiles And continue = true
    Kill(fileList.item(i)text)
    i = i + 1
    end sub


    Something like that should work. Note that if you delete 100 files at once, you only have a couple of seconds to cancel. But if the user of your program deletes about 10 files (or less) you won't get the chance to cancel.
    Instead I would recommend a prompt box which asks for comfirmation so the user is sure.

    Good luck!
    Marty
  • compuwizjrcompuwizjr Posts: 73Member
    : : : : I'm working on a personalized wipe-out disk for a friend, but I can't figure out how to make it delete the file the person specifies. You see, I have a text box(txtFile) where the user will type in the name of the file, a text box(txtSource) where the user will type in the location of the file, then the start button(txtDelete), but my problem is that I don't know the code to delete the file specified in the "txtFile" box. Can some one help me?
    : : : :
    : : :
    : : : I think there is a command 'kill' which can remove files.
    : : : Example: Kill ("c: emp est.txt")
    : : : So in your case : Kill (txtSource.Text & txtFile.Text)
    : : :
    : : : To remove directories use: rmdir
    : : : Example: Rmdir ("c: emp")
    : : : Note that the last function only works if ALL files AND folders are removed in that folder so the folder is empty.
    : : :
    : : : Good luck!
    : : : Marty
    : : :
    : : : Thanks for your help, but now I have another problem. I also have "Cancel" button, and I can't figure out what kind of code to use for the button to make the delete action stop.
    : :
    : :
    : :
    :
    : Well you can't really stop one Kill command. What you can do is stop a loop in which more files are deleted.
    : For example if you delete 100 files in a directory using a while loop, create a public boolean continue which is set on true initially. I you press cancel this boolean will be set to false so that the loop won't continue.
    :
    : Example:
    : general
    : public continue as boolean
    : -----
    : public sub deleteFiles ()
    : continue = true
    : While i < numberOfFiles And continue = true
    : Kill(fileList.item(i)text)
    : i = i + 1
    : end sub
    :
    :
    : Something like that should work. Note that if you delete 100 files at once, you only have a couple of seconds to cancel. But if the user of your program deletes about 10 files (or less) you won't get the chance to cancel.
    : Instead I would recommend a prompt box which asks for comfirmation so the user is sure.
    :
    : Good luck!
    : Marty
    :
    Okay, so I used the exact code you gave me for the kill command, and I don't exactly understand the code for my cancel button, but I also need help with how to make a prompt box to ask for confirmation.
    CompuWizJR

  • compuwizjrcompuwizjr Posts: 73Member
    : : : : : I'm working on a personalized wipe-out disk for a friend, but I can't figure out how to make it delete the file the person specifies. You see, I have a text box(txtFile) where the user will type in the name of the file, a text box(txtSource) where the user will type in the location of the file, then the start button(txtDelete), but my problem is that I don't know the code to delete the file specified in the "txtFile" box. Can some one help me?
    : : : : :
    : : : :
    : : : : I think there is a command 'kill' which can remove files.
    : : : : Example: Kill ("c: emp est.txt")
    : : : : So in your case : Kill (txtSource.Text & txtFile.Text)
    : : : :
    : : : : To remove directories use: rmdir
    : : : : Example: Rmdir ("c: emp")
    : : : : Note that the last function only works if ALL files AND folders are removed in that folder so the folder is empty.
    : : : :
    : : : : Good luck!
    : : : : Marty
    : : : :
    : : : : Thanks for your help, but now I have another problem. I also have "Cancel" button, and I can't figure out what kind of code to use for the button to make the delete action stop.
    : : :
    : : :
    : : :
    : :
    : : Well you can't really stop one Kill command. What you can do is stop a loop in which more files are deleted.
    : : For example if you delete 100 files in a directory using a while loop, create a public boolean continue which is set on true initially. I you press cancel this boolean will be set to false so that the loop won't continue.
    : :
    : : Example:
    : : general
    : : public continue as boolean
    : : -----
    : : public sub deleteFiles ()
    : : continue = true
    : : While i < numberOfFiles And continue = true
    : : Kill(fileList.item(i)text)
    : : i = i + 1
    : : end sub
    : :
    : :
    : : Something like that should work. Note that if you delete 100 files at once, you only have a couple of seconds to cancel. But if the user of your program deletes about 10 files (or less) you won't get the chance to cancel.
    : : Instead I would recommend a prompt box which asks for comfirmation so the user is sure.
    : :
    : : Good luck!
    : : Marty
    : :
    : Okay, so I used the exact code you gave me for the kill command, and I don't exactly understand the code for my cancel button, but I also need help with how to make a prompt box to ask for confirmation.
    : CompuWizJR
    :
    :
    With the code you just gave me, I get the following Task List build error:Statement cannot appear within a method body. End of method assumed.
    It's from the "Public Sub" part of the code. What does it mean, and how do I fix it?
    CompuWizJR

Sign In or Register to comment.