private void buttonSelectDate_Click(object sender, EventArgs e) { DateTime selDate; if (!DateTime.TryParse(textAlarmDateTime.Text, out selDate)) { selDate = DateTime.Now; } DateSelectorForm dateSelector = new DateSelectorForm(); dateSelector.Date = selDate; if (dateSelector.ShowDialog() == DialogResult.OK) { textAlarmDateTime.Text = dateSelector.Date.ToString("dd/MM/yyyy HH:mm"); } }
private string SelDate(string date) { DateTime selDateIn; string selDate = ""; if (!DateTime.TryParse(date, out selDateIn)) { selDateIn = DateTime.Now; } DateSelectorForm dateSelector = new DateSelectorForm(); dateSelector.Date = selDateIn; if (dateSelector.ShowDialog() == DialogResult.OK) { selDate = dateSelector.Date.ToString("dd/MM/yyyy HH:mm"); } return(selDate); }