Imports System.IO Public Class CreateDir Inherits System.Web.UI.Page Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox Protected WithEvents Label1 As System.Web.UI.WebControls.Label Protected WithEvents Label2 As System.Web.UI.WebControls.Label Protected WithEvents DropDownList1 As System.Web.UI.WebControls.DropDownList Protected WithEvents btnCreate As System.Web.UI.WebControls.Button Protected WithEvents btnDelete As System.Web.UI.WebControls.Button #Region " Web Form Designer Generated Code " 'This call is required by the Web Form Designer. Private Sub InitializeComponent() End Sub Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeComponent() End Sub #End Region Dim MyPath As String Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'Put user code to initialize the page here MyPath = "c:\Inetpub\wwwroot\Chapter12\Users\" If Not Page.IsPostBack Then Label1.Text = _ "Enter the name of the subdirectory to create." Call DisplayDirectory(MyPath) DropDownList1.Visible = False btnDelete.Visible = False Else DropDownList1.Visible = True btnDelete.Visible = True Call DisplayDirectory(MyPath) End If End Sub Public Function DisplayDirectory(ByVal MyPath) ' Insert the code here End Function Private Sub btnCreate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCreate.Click Try ' Insert the code here DisplayDirectory(MyPath) Label1.Text = "The " & TextBox1.Text & _ " directory was created successfully." Catch exc As ArgumentException Label1.Text = "You must enter a valid name to create a directory." Catch exc As ArgumentNullException Label1.Text = "You must enter a name to create a directory." Catch exc As IOException Label1.Text = "The directory already exists." Catch exc As PathTooLongException Label1.Text = "The directory name is to long." End Try TextBox1.Text = "" DisplayDirectory(MyPath) End Sub Private Sub btnDelete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDelete.Click Try ' Insert the code here Catch exc As NullReferenceException Label1.Text = "You must specify a directory to delete." Catch exc As UnauthorizedAccessException Label1.Text = "You are not authorized to delete this directory." End Try TextBox1.Text = "" DisplayDirectory(MyPath) End Sub End Class