private void editToolStripMenuItem_Click(object sender, EventArgs e) { //Get the index of the reminder int index = 0; if (listView1.SelectedItems.Count > 0) index = listView1.SelectedIndices[0]; //Open the form for adding/editing reminders FrmAddReminder frmAddReminder = new FrmAddReminder(this, true, index); //Split the reminder with index to get all info String[] info = reminders[index].Split(';'); //Convert the time to DateTime for use in datetimepicker DateTime nwdt = new DateTime(); nwdt = Convert.ToDateTime(info[1]); //Set all the values in the form to edit frmAddReminder.Show(); List<int> days = dayToInt(info[0]); for (int i = 0; i < days.Count; i++) { frmAddReminder.dayBox.SetItemChecked(days[i], true); } frmAddReminder.timePicker.Value = nwdt; frmAddReminder.textBox1.Text = info[2]; if (info[3] == "Yes") { frmAddReminder.recurringBox.Checked = true; } else { frmAddReminder.recurringBox.Checked = false; } if (info[4] == "Yes") { frmAddReminder.activeBox.Checked = true; } else { frmAddReminder.activeBox.Checked = false; } frmAddReminder.comboBox1.SelectedItem = info[5]; //Show the form //frmAddReminder.Show(); }
private void button1_Click(object sender, EventArgs e) { //Open the form for adding reminders FrmAddReminder frmAddReminder = new FrmAddReminder(this, false, 0); frmAddReminder.Show(); }