I can't figure out what Microsoft insanity is going on here. I'm trying to keep track of what screen the form is on when the program is closed. When it opens back up it will start on the My.Settings.LastScreen. I decided the easiest way was simply track the device names. I iterate through the screens and look for the matching name.
Very simple. However it doesn't work. Even when the two values are the same they are never the same. No matter what I do to them .ToString/.ToLower/.Trim/etc they never equal even though when I break and look at the values they are the same ("\\.\DISPLAY1 or "\\.\DISPLAY1"). WT?
-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!
Code:
Dim CurrentScreen As Screen
Dim Screens As Screen() = Screen.AllScreens
For Each cScreen As String In Screens
If My.Settings.LastScreen = cScreen.DeviceName Then CurrentScreen = cScreen
Next
Very simple. However it doesn't work. Even when the two values are the same they are never the same. No matter what I do to them .ToString/.ToLower/.Trim/etc they never equal even though when I break and look at the values they are the same ("\\.\DISPLAY1 or "\\.\DISPLAY1"). WT?
-I hate Microsoft!
-Forever and always forward.
-My kingdom for a edit button!