private void lbOrderID_SelectedIndexChanged(object sender, EventArgs e) { if (lbOrderID.SelectedIndex >= 0) { dgvOrders.DataSource = logdata.GetLogsbyOrderID(lbOrderID.Text); updategrid(); try { label1.Text = "Transaction Date: " + new DateTime(int.Parse(lbOrderID.Text.Substring(0, 4)), int.Parse(lbOrderID.Text.Substring(4, 2)), int.Parse(lbOrderID.Text.Substring(6, 2)), int.Parse(lbOrderID.Text.Substring(8, 2)), int.Parse(lbOrderID.Text.Substring(10, 2)), int.Parse(lbOrderID.Text.Substring(12, 2))).ToString(@"dddd, MMMM dd, yyyy Tran\sac\tion Ti\me: hh:mm:ss tt"); } catch (Exception ex) { label1.Text = ""; } } }