>> datepicker control picks the dates only in this format for example: "MM/dd/yyyy"
and
>> textboxes in format "dd/MM/yyyy" then it works fine
I provided you the swap code, to make MM/dd/yyyy to dd/MM/yyyy
textBox1.Text = ????? <---------------------- date from your control, then
string[] temp = textBox1.Text.Split('/');
string t = null;
t = temp[1];
temp[1] = temp[0];
temp[0] = t;
textBox1.Text = string.Join("/", temp); 'now it becomes dd/MM/yyyy format in textBox1and IF you have only dates in textbox1then this will show you correct result:
IFormatProvider culture = new CultureInfo("fr-FR", true);
DateTime checkindate = DateTime.Parse(textBox1.Text, culture, DateTimeStyles.NoCurrentDateDefault);
DateTime checkoutdate = DateTime.Parse(textBox2.Text, culture, DateTimeStyles.NoCurrentDateDefault);
TimeSpan ts = checkoutdate.Subtract(checkindate);
int daysOrTimeperiod = (int)Math.Abs(ts.Days);
MessageBox.Show(daysOrTimeperiod.ToString());