Results 1 to 2 of 2

Thread: Newb Question

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2002
    Posts
    8

    Unhappy Newb Question

    Well I just started trying to learn VB.NET recently, and I dont know any code.

    I have a good idea for a form with simple buttons. All I need is the code to make it work. I want it to delete the contents of folders without any prompts. I wish to have a few buttons to delete different folders. I also want to have one big button to delete them all if that is possible. All I need is someone to write or explain what code I would need for a specific button.

    Just shove it in here

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    <<<<<<<--- Here ----- >>>>>>>>

    End Sub

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    VB Code:
    1. Imports System.IO.Directory
    2.  
    3.     'Declares
    4.     Public mydir As IO.Directory
    5.     Public path As String = Application.StartupPath
    6.    
    7.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    8.         mydir.Delete(path & "\" & "myfolder", True)
    9.     End Sub
    10.  
    11.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    12.         mydir.CreateDirectory(path & "\" & "myfolder")
    13.     End Sub
    very simple,Isn't ? the code explains itself.
    setting delete value to true would delete all the contents of that folder.
    this should get you started.

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