I'm developing an app to send SMS messages and one of the requirements is the 'Send Date & Time' which I need to pass to the provider when sending the message.
On my form there is a Checkbox for the user to click is they want to send the message on a particulr date and time (Send Later), if this isn't checked the message is sent using the current system date and time.
For this I've been using: -
System.DateTime dt = DateTime.Now;
I now want to change my code to include a check to see if the user has selected to 'Send Later' and if so use the selected date from the DateEdit control and time from the TimeEdit control. The If - Else is ok, but I'm having problems setting 'dt' from the date & time controls and converting the strings. This is what I tried: -
System.DateTime dt;
if (chkLater != null)
{
dt = System.DateTime.Now;
}
else
{
dt = dateSend.Text;
}
But I get an error 'Cannot implicitly convert type 'string' to 'System.Date.Time'
Any suggestions on the best way to handle this
PS. How do I display code in my posts more clearly