private void timer5_Tick(object sender, EventArgs e) { NetworkDrive oNetDrive1 = new NetworkDrive(); zUpdateStatus("Mapping ********... "); try { oNetDrive1.LocalDrive = "w:"; oNetDrive1.ShareName = @"\\*******\**"; //match call to options provided if (txtPassword.Text == "" && txtUsername.Text == "") { oNetDrive1.MapDrive(); } else if (txtUsername.Text == "") { oNetDrive1.MapDrive(txtPassword.Text); } else { oNetDrive1.MapDrive("w2k\\" + txtUsername.Text, txtPassword.Text); } //update status zUpdateStatus("Drive map successful."); } catch (Exception err1) { //report error zUpdateStatus("Cannot map drive! - " + err1.Message); MessageBox.Show(this, "Error (W). The systems administrator has been notified.\nError: " + err1.Message); } oNetDrive1 = null; }