I haven't actually figured that out. I switched to using StandardName. I have to store the text in a database so I can set the timezone the next time the device runs and the control characters in DIsplayName were messing me up big time. Its one of those WinCE devices with the protected OS and the timezone isn't written to the registry unless a special program is run.
I have found out that DisplayName has control character(s) before going through a combobox but whatever it is seems to change when added to and extracted from the combobox. If I do this:
MyTImeZoneState=DateTimeHelper( MyTimeZoneInformation)
tzc.Initialize()
For Each tzi As OpenNETCF.WindowsCE.TimeZoneInformation In tzc
TheIndex = cbTimeZones.Items.Add(tzi)
If tzi.DisplayName = MyTimeZoneInformation.DisplayName Then
cbTimeZones.SelectedIndex = TheIndex
MyTimeZoneInformation = tzi
End If
Next
msgbox("'" + MyTImeZoneInformation +"'")
Then I get a messagebox with the DisplayName surrounded by single quotes.
MyTimeZoneInformation = CType(cbTimeZones.SelectedItem, TimeZoneInformation)
At this point if I do
msgbox("'" + MyTImeZoneInformation +"'")
I get only the first single quote and the msgbox text is terminated at the end of the DIsplayName regardless of what I add to the end of the message and trying to store the string with SQLite raises an exception (unless I use parameterized queries).
If I strip all characters with an ascii value less than 32 from the string then msgbox shows the entire message and SQLite is happy with the update query without parameterization.
Now, here's the part I just figured out: The control character(s) exist before going through the combobox and going through the combobox changes the character(s).
When I compare the stripped string to the tzi.DisplayName in the combobox loading loop there is no match. If I strip tzi.DisplayName of control characters then compare then there is a match. If I store the unstripped tzi and compare it to MyTimeZoneInformation after casting the object from the combobox there is no match.
Yet if I use StandardName or DaylightName in all of the above there is never any problem or need to strip control character.