private void btnStartPick_Click(object sender, EventArgs e) { // Generate file name try { String strFileName = strDataDirectory + System.Net.Dns.GetHostName() + "-Pick-" + DateTime.Now.ToString("yyyyMMddHHmmss") + ((this.txtWorkID.Text.Length != 0) ? "-" : "") + this.txtWorkID.Text.ToString() + ".csv"; // Open Form 2 using (Form2Pick f2pick = new Form2Pick(strFileName)) { f2pick.ShowDialog(); this.loadFileNamesInListBox(); } } catch (Exception ex) { MessageBox.Show("Cannot generate file name and launch app.\n" + ex.Message); } }