by Sisyphus » Wed Jan 11, 2012 3:35 am
Hi,
Your question shows that you are on the right track. To solve the problem I need to try things out. So, why don't you go firs? But thinking ahead may help:-
You are taking a String from the DatePicker. Whenever you convert this String to a Date the conversion will be done according to the rules of the local Excel. On your machine the month will be placed in first position, on your customer's in second. Then you force a reversal. It's an even bet that this is what causes the upset.
The String taken from the date picker is correct, though different, on both machines. Your code that manipulates it must be capable of turning out the desired result regardless of where the month is in the String.
Indeed, you may read the date from the date picker as a date, too. The only thing to remember is to let Excel do the presentation and don't interfere with that unless you can take full control, which you can't if you have a Date. You may leave everything to Excel. Format the date as "Short Date" to use the Regional Settings of the machine where your program runs. If 40397 is Jan 1, 2012 as taken from the date picker (as a Date) Excel will show day, month and year in correct sequence on any installation, anywhere, but not necessarily as you have imagined.
Have a great day!
Sisyphus
I do this for "honour and country" - much less of the latter, actually.
If I helped you, award points, plenty of them.
If I bored you, deduct points for being too long-winded. (I know, :lol)