using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace SanSystem { public partial class frmOffsetSet : Form { public DateTime Offset; public frmOffsetSet(DateTime off) { InitializeComponent(); if (off != DateTime.MinValue) { txt_offset.Text = off.TimeOfDay.ToString(); dateTimePicker.Value = off; } } private void Btn_save_Click(object sender, EventArgs e) { string s = string.Format("{0} {1}", dateTimePicker.Value.ToShortDateString(), txt_offset.Text); try { Offset = DateTime.Parse(s); } catch(System.FormatException ex) { MessageBox.Show("Fehler beim Datum, es wird das jetzige Datum verwendet\n"+ex.Message); Offset = DateTime.Now; } this.Close(); } } }