winforms - how to get the value from a dateTime picker and combo box and set it as a dateTime variable? In c# -
i have windows form in c# user has pick date datetime picker , time combo box. how store them in same datetime variable?
assuming have 2 separate fields, datetime picker returning datetime object (pickervalue) , combobox returning string value (dropdownvalue):
datetime finalvalue; try { timespan ddvalue = timespan.parse(dropdownvalue); finalvalue = pickervalue.date.addticks(ddvalue.ticks); } catch (exception) { //handle exception // dropdownvalue not formatted timestring. finalvalue = pickervalue.date; //or handle }