473,385 Members | 1,311 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Dual Monitors in VB.NET - HELP!

I have been experimenting with the Screen object. It has a property
called Screen.DeviceName which returns a string value similar to the
following:

\\.\DISPLAY1 or \\.\DISPLAY2

I have 2 questions. When I assign the value to a class property and then
serialize that class using a SoapFormatter I get a bunch of garbage
characters after the name. Console.Writeline does not display these
characters, but it does show a " in front of the string but not at the end?

Secondly, I want my application to remember which monitor it was
displayed on, and in what location and size etc.

I have the size handled okay, and using SetDesktopBounds I can get it
back where it started, but cannot seem to figure out how to tell it
which monitor to use?

Any help would be appreciated.

Cheers,

Robert Porter
Nov 21 '05 #1
9 15740
Hi

First, I suggest you assign the DeviceName to a string first, and note the
length to see if it has redundant character, and then serialize the string
value direct to see if the problem persists.
Based on my test, it is shown correct in messagebox.

Second, for the monitor issue, I think we may use the DesktopLocation
property to set a position large than first desktop.
e.g. the first desktop is 1024*768, then we can set the DesktopLocation to
1100,100, then it will show on the second monitor.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #2
Peter Huang [MSFT] wrote:
Hi

First, I suggest you assign the DeviceName to a string first, and note the
length to see if it has redundant character, and then serialize the string
value direct to see if the problem persists.
Based on my test, it is shown correct in messagebox.

Second, for the monitor issue, I think we may use the DesktopLocation
property to set a position large than first desktop.
e.g. the first desktop is 1024*768, then we can set the DesktopLocation to
1100,100, then it will show on the second monitor.

Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Thank you for the reply, but I am not trying to make the screen larger
than one desktop, I want to be able to place the form on the secondary
monitor if it was last there, or the primary monitor if it was last
displayed there. My program always places the form on the primary
monitor and I would like to be able to override that.

I did assign the value to a string property first, and in MsgBox it
displays correctly. When serialized using the SoapFormatter it is when
it seems to acquire the extra garbage characters.

Any help would be appreciated.
Nov 21 '05 #3
Robert,
It sounds like Screen.DeviceName contains an embedded and/or trailing Null
Chars (ControlChars.NullChar).

Remember that ControlChars.NullChar is a valid System.String character,
however most Win32 APIs, including the VS.NET debugger, treat it as a string
terminator.

I would use either String.Trim or String.SubString to remove the trailing
ControlChars.NullChar.

Dim s As Screen
Dim deviceName As String

Dim length As Integer =
s.DeviceName.IndexOf(ControlChars.NullChar)
If length = -1 Then
deviceName = s.DeviceName
Else
deviceName = s.DeviceName.Substring(0, length)
End If

Hope this helps
Jay

"Robert Porter" <rh******@noemail.nospam> wrote in message
news:e%*****************@TK2MSFTNGP10.phx.gbl...
|I have been experimenting with the Screen object. It has a property
| called Screen.DeviceName which returns a string value similar to the
| following:
|
| \\.\DISPLAY1 or \\.\DISPLAY2
|
| I have 2 questions. When I assign the value to a class property and then
| serialize that class using a SoapFormatter I get a bunch of garbage
| characters after the name. Console.Writeline does not display these
| characters, but it does show a " in front of the string but not at the
end?
|
| Secondly, I want my application to remember which monitor it was
| displayed on, and in what location and size etc.
|
| I have the size handled okay, and using SetDesktopBounds I can get it
| back where it started, but cannot seem to figure out how to tell it
| which monitor to use?
|
| Any help would be appreciated.
|
| Cheers,
|
| Robert Porter
Nov 21 '05 #4
That was perfect! Worked for me... Many thanks! Now you would not happen
to know how I can tell a form to appear, other than maximized, on a
screen other than the primary display would you?

Cheers,

Bob Porter

Jay B. Harlow [MVP - Outlook] wrote:
Robert,
It sounds like Screen.DeviceName contains an embedded and/or trailing Null
Chars (ControlChars.NullChar).

Remember that ControlChars.NullChar is a valid System.String character,
however most Win32 APIs, including the VS.NET debugger, treat it as a string
terminator.

I would use either String.Trim or String.SubString to remove the trailing
ControlChars.NullChar.

Dim s As Screen
Dim deviceName As String

Dim length As Integer =
s.DeviceName.IndexOf(ControlChars.NullChar)
If length = -1 Then
deviceName = s.DeviceName
Else
deviceName = s.DeviceName.Substring(0, length)
End If

Hope this helps
Jay

"Robert Porter" <rh******@noemail.nospam> wrote in message
news:e%*****************@TK2MSFTNGP10.phx.gbl...
|I have been experimenting with the Screen object. It has a property
| called Screen.DeviceName which returns a string value similar to the
| following:
|
| \\.\DISPLAY1 or \\.\DISPLAY2
|
| I have 2 questions. When I assign the value to a class property and then
| serialize that class using a SoapFormatter I get a bunch of garbage
| characters after the name. Console.Writeline does not display these
| characters, but it does show a " in front of the string but not at the
end?
|
| Secondly, I want my application to remember which monitor it was
| displayed on, and in what location and size etc.
|
| I have the size handled okay, and using SetDesktopBounds I can get it
| back where it started, but cannot seem to figure out how to tell it
| which monitor to use?
|
| Any help would be appreciated.
|
| Cheers,
|
| Robert Porter

Nov 21 '05 #5
Robert,
I normally set the bounds of the form to the bounds of the Screen (monitor)
that I want the form to appear on.

Something like:

Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
Dim s As Screen
For Each s In Screen.AllScreens
If Not s.Primary Then Exit For
Next
Me.Bounds = s.Bounds
Me.WindowState = FormWindowState.Maximized
End Sub

Will cause the form to appear "full screen" on the first secondary monitor
if one is present.

You should be able to use Rectangle.Location & Rectangle.Offset to adjust
the bounds before you set them if you don't want a "full screen" window.
Post if you need help with offsetting the bounds.

Hope this helps
Jay

"Robert Porter" <rh******@noemail.nospam> wrote in message
news:O9*************@TK2MSFTNGP12.phx.gbl...
| That was perfect! Worked for me... Many thanks! Now you would not happen
| to know how I can tell a form to appear, other than maximized, on a
| screen other than the primary display would you?
|
| Cheers,
|
| Bob Porter
|
| Jay B. Harlow [MVP - Outlook] wrote:
| > Robert,
| > It sounds like Screen.DeviceName contains an embedded and/or trailing
Null
| > Chars (ControlChars.NullChar).
| >
| > Remember that ControlChars.NullChar is a valid System.String character,
| > however most Win32 APIs, including the VS.NET debugger, treat it as a
string
| > terminator.
| >
| > I would use either String.Trim or String.SubString to remove the
trailing
| > ControlChars.NullChar.
| >
| > Dim s As Screen
| > Dim deviceName As String
| >
| > Dim length As Integer =
| > s.DeviceName.IndexOf(ControlChars.NullChar)
| > If length = -1 Then
| > deviceName = s.DeviceName
| > Else
| > deviceName = s.DeviceName.Substring(0, length)
| > End If
| >
| > Hope this helps
| > Jay
| >
| > "Robert Porter" <rh******@noemail.nospam> wrote in message
| > news:e%*****************@TK2MSFTNGP10.phx.gbl...
| > |I have been experimenting with the Screen object. It has a property
| > | called Screen.DeviceName which returns a string value similar to the
| > | following:
| > |
| > | \\.\DISPLAY1 or \\.\DISPLAY2
| > |
| > | I have 2 questions. When I assign the value to a class property and
then
| > | serialize that class using a SoapFormatter I get a bunch of garbage
| > | characters after the name. Console.Writeline does not display these
| > | characters, but it does show a " in front of the string but not at the
| > end?
| > |
| > | Secondly, I want my application to remember which monitor it was
| > | displayed on, and in what location and size etc.
| > |
| > | I have the size handled okay, and using SetDesktopBounds I can get it
| > | back where it started, but cannot seem to figure out how to tell it
| > | which monitor to use?
| > |
| > | Any help would be appreciated.
| > |
| > | Cheers,
| > |
| > | Robert Porter
| >
| >
Nov 21 '05 #6
The bounds bit works... but it slams the window to full screen. I sure
could use some help offsetting the bounds.

I have been playing with saving the height, top and left, then trying to
dynamically resize the form on the secondary monitor as far as width
goes, but I somehow always end up with it full screen, here is the code
I have so far.

If oLUConfig.HasBeenConfigured Then
Me.Height = oLUConfig.IRHeight
Me.Width = oLUConfig.IRWidth
Me.Left = oLUConfig.IRLeft
Me.Top = oLUConfig.IRTop
If CheckForMultipleMonitors() AndAlso
(oLUConfig.IRScreenDeviceName <> "") Then
Dim s As Screen
Dim bFound As Boolean = False
Dim sName As String

For Each s In Screen.AllScreens
sName =oUtility.StripControlCharacters(s.DeviceName)
If sName = oLUConfig.IRScreenDeviceName Then
Me.SetDesktopBounds(Me.Left, Me.Top, Me.Width,
Me.Height)
bFound = True
me.bounds = s.bounds
me.setdesktopbounds(oluconfig.IRLeft, oluconfig.IRTop,
oluconfig.IRWidth, oluconfig.IRHeight)
Exit For
End If
Next
If Not bFound Then
Me.Bounds = Screen.PrimaryScreen.Bounds
End If
Else
Me.Bounds = Screen.PrimaryScreen.Bounds
End If
Else
Me.Height = 256
Me.Width = Screen.PrimaryScreen.WorkingArea.Width
Me.Top = iScreenHeight - Me.Height
Me.Left = Screen.PrimaryScreen.WorkingArea.Left
Me.SetDesktopBounds(Me.Left, Me.Top, Me.Width, Me.Height)
End If
Jay B. Harlow [MVP - Outlook] wrote:
Robert,
I normally set the bounds of the form to the bounds of the Screen (monitor)
that I want the form to appear on.

Something like:

Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
Dim s As Screen
For Each s In Screen.AllScreens
If Not s.Primary Then Exit For
Next
Me.Bounds = s.Bounds
Me.WindowState = FormWindowState.Maximized
End Sub

Will cause the form to appear "full screen" on the first secondary monitor
if one is present.

You should be able to use Rectangle.Location & Rectangle.Offset to adjust
the bounds before you set them if you don't want a "full screen" window.
Post if you need help with offsetting the bounds.

Hope this helps
Jay

"Robert Porter" <rh******@noemail.nospam> wrote in message
news:O9*************@TK2MSFTNGP12.phx.gbl...
| That was perfect! Worked for me... Many thanks! Now you would not happen
| to know how I can tell a form to appear, other than maximized, on a
| screen other than the primary display would you?
|
| Cheers,
|
| Bob Porter
|
| Jay B. Harlow [MVP - Outlook] wrote:
| > Robert,
| > It sounds like Screen.DeviceName contains an embedded and/or trailing
Null
| > Chars (ControlChars.NullChar).
| >
| > Remember that ControlChars.NullChar is a valid System.String character,
| > however most Win32 APIs, including the VS.NET debugger, treat it as a
string
| > terminator.
| >
| > I would use either String.Trim or String.SubString to remove the
trailing
| > ControlChars.NullChar.
| >
| > Dim s As Screen
| > Dim deviceName As String
| >
| > Dim length As Integer =
| > s.DeviceName.IndexOf(ControlChars.NullChar)
| > If length = -1 Then
| > deviceName = s.DeviceName
| > Else
| > deviceName = s.DeviceName.Substring(0, length)
| > End If
| >
| > Hope this helps
| > Jay
| >
| > "Robert Porter" <rh******@noemail.nospam> wrote in message
| > news:e%*****************@TK2MSFTNGP10.phx.gbl...
| > |I have been experimenting with the Screen object. It has a property
| > | called Screen.DeviceName which returns a string value similar to the
| > | following:
| > |
| > | \\.\DISPLAY1 or \\.\DISPLAY2
| > |
| > | I have 2 questions. When I assign the value to a class property and
then
| > | serialize that class using a SoapFormatter I get a bunch of garbage
| > | characters after the name. Console.Writeline does not display these
| > | characters, but it does show a " in front of the string but not at the
| > end?
| > |
| > | Secondly, I want my application to remember which monitor it was
| > | displayed on, and in what location and size etc.
| > |
| > | I have the size handled okay, and using SetDesktopBounds I can get it
| > | back where it started, but cannot seem to figure out how to tell it
| > | which monitor to use?
| > |
| > | Any help would be appreciated.
| > |
| > | Cheers,
| > |
| > | Robert Porter
| >
| >

Nov 21 '05 #7
Robert,
You should only set the Form.Bounds to Screen.Bounds if you want Full
Screen.

Seeing as you have a position in mind, I would simply set the Form.Location
to the Saved.Location + Screen.Bounds.Location.

Something like:

Protected Overrides Sub OnLoad(ByVal e As EventArgs)
MyBase.OnLoad(e)
Dim secondaryScreen As Screen

' look up the secondaryScreen
For Each secondaryScreen In Screen.AllScreens
If Not secondaryScreen.Primary Then Exit For
Next

' Use the primary screen if there is no secondary screen
If secondaryScreen Is Nothing Then secondaryScreen =
Screen.PrimaryScreen

' Move the form to the secondary screen

' use the forms current location
Dim location As Point = Me.Location
' or you could use the saved location
Dim location As New Point(oLUConfig.IRLeft, oLUConfig.IRTop)

location.Offset(secondaryScreen.Bounds.X, secondaryScreen.Bounds.Y)

Me.Location = location

' Assumes the size is already set...

End Sub
Hope this helps
Jay
"Robert Porter" <rh******@noemail.nospam> wrote in message
news:e0**************@tk2msftngp13.phx.gbl...
| The bounds bit works... but it slams the window to full screen. I sure
| could use some help offsetting the bounds.
|
| I have been playing with saving the height, top and left, then trying to
| dynamically resize the form on the secondary monitor as far as width
| goes, but I somehow always end up with it full screen, here is the code
| I have so far.
|
| If oLUConfig.HasBeenConfigured Then
| Me.Height = oLUConfig.IRHeight
| Me.Width = oLUConfig.IRWidth
| Me.Left = oLUConfig.IRLeft
| Me.Top = oLUConfig.IRTop
| If CheckForMultipleMonitors() AndAlso
| (oLUConfig.IRScreenDeviceName <> "") Then
| Dim s As Screen
| Dim bFound As Boolean = False
| Dim sName As String
|
| For Each s In Screen.AllScreens
| sName =oUtility.StripControlCharacters(s.DeviceName)
| If sName = oLUConfig.IRScreenDeviceName Then
| Me.SetDesktopBounds(Me.Left, Me.Top, Me.Width,
| Me.Height)
| bFound = True
| me.bounds = s.bounds
| me.setdesktopbounds(oluconfig.IRLeft, oluconfig.IRTop,
| oluconfig.IRWidth, oluconfig.IRHeight)
| Exit For
| End If
| Next
| If Not bFound Then
| Me.Bounds = Screen.PrimaryScreen.Bounds
| End If
| Else
| Me.Bounds = Screen.PrimaryScreen.Bounds
| End If
| Else
| Me.Height = 256
| Me.Width = Screen.PrimaryScreen.WorkingArea.Width
| Me.Top = iScreenHeight - Me.Height
| Me.Left = Screen.PrimaryScreen.WorkingArea.Left
| Me.SetDesktopBounds(Me.Left, Me.Top, Me.Width, Me.Height)
| End If
|
|
| Jay B. Harlow [MVP - Outlook] wrote:
| > Robert,
| > I normally set the bounds of the form to the bounds of the Screen
(monitor)
| > that I want the form to appear on.
| >
| > Something like:
| >
| > Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
| > Dim s As Screen
| > For Each s In Screen.AllScreens
| > If Not s.Primary Then Exit For
| > Next
| > Me.Bounds = s.Bounds
| > Me.WindowState = FormWindowState.Maximized
| > End Sub
| >
| > Will cause the form to appear "full screen" on the first secondary
monitor
| > if one is present.
| >
| > You should be able to use Rectangle.Location & Rectangle.Offset to
adjust
| > the bounds before you set them if you don't want a "full screen" window.
| > Post if you need help with offsetting the bounds.
| >
| > Hope this helps
| > Jay
| >
| > "Robert Porter" <rh******@noemail.nospam> wrote in message
| > news:O9*************@TK2MSFTNGP12.phx.gbl...
| > | That was perfect! Worked for me... Many thanks! Now you would not
happen
| > | to know how I can tell a form to appear, other than maximized, on a
| > | screen other than the primary display would you?
| > |
| > | Cheers,
| > |
| > | Bob Porter
| > |
| > | Jay B. Harlow [MVP - Outlook] wrote:
| > | > Robert,
| > | > It sounds like Screen.DeviceName contains an embedded and/or
trailing
| > Null
| > | > Chars (ControlChars.NullChar).
| > | >
| > | > Remember that ControlChars.NullChar is a valid System.String
character,
| > | > however most Win32 APIs, including the VS.NET debugger, treat it as
a
| > string
| > | > terminator.
| > | >
| > | > I would use either String.Trim or String.SubString to remove the
| > trailing
| > | > ControlChars.NullChar.
| > | >
| > | > Dim s As Screen
| > | > Dim deviceName As String
| > | >
| > | > Dim length As Integer =
| > | > s.DeviceName.IndexOf(ControlChars.NullChar)
| > | > If length = -1 Then
| > | > deviceName = s.DeviceName
| > | > Else
| > | > deviceName = s.DeviceName.Substring(0, length)
| > | > End If
| > | >
| > | > Hope this helps
| > | > Jay
| > | >
| > | > "Robert Porter" <rh******@noemail.nospam> wrote in message
| > | > news:e%*****************@TK2MSFTNGP10.phx.gbl...
| > | > |I have been experimenting with the Screen object. It has a property
| > | > | called Screen.DeviceName which returns a string value similar to
the
| > | > | following:
| > | > |
| > | > | \\.\DISPLAY1 or \\.\DISPLAY2
| > | > |
| > | > | I have 2 questions. When I assign the value to a class property
and
| > then
| > | > | serialize that class using a SoapFormatter I get a bunch of
garbage
| > | > | characters after the name. Console.Writeline does not display
these
| > | > | characters, but it does show a " in front of the string but not at
the
| > | > end?
| > | > |
| > | > | Secondly, I want my application to remember which monitor it was
| > | > | displayed on, and in what location and size etc.
| > | > |
| > | > | I have the size handled okay, and using SetDesktopBounds I can get
it
| > | > | back where it started, but cannot seem to figure out how to tell
it
| > | > | which monitor to use?
| > | > |
| > | > | Any help would be appreciated.
| > | > |
| > | > | Cheers,
| > | > |
| > | > | Robert Porter
| > | >
| > | >
| >
| >
Nov 21 '05 #8
Excellent! That's what I needed, I had not looked at location.offset
before. Thanks very much for your continued help.

Cheers,

Bob

Jay B. Harlow [MVP - Outlook] wrote:
Robert,
You should only set the Form.Bounds to Screen.Bounds if you want Full
Screen.

Seeing as you have a position in mind, I would simply set the Form.Location
to the Saved.Location + Screen.Bounds.Location.

Something like:

Protected Overrides Sub OnLoad(ByVal e As EventArgs)
MyBase.OnLoad(e)
Dim secondaryScreen As Screen

' look up the secondaryScreen
For Each secondaryScreen In Screen.AllScreens
If Not secondaryScreen.Primary Then Exit For
Next

' Use the primary screen if there is no secondary screen
If secondaryScreen Is Nothing Then secondaryScreen =
Screen.PrimaryScreen

' Move the form to the secondary screen

' use the forms current location
Dim location As Point = Me.Location
' or you could use the saved location
Dim location As New Point(oLUConfig.IRLeft, oLUConfig.IRTop)

location.Offset(secondaryScreen.Bounds.X, secondaryScreen.Bounds.Y)

Me.Location = location

' Assumes the size is already set...

End Sub
Hope this helps
Jay
"Robert Porter" <rh******@noemail.nospam> wrote in message
news:e0**************@tk2msftngp13.phx.gbl...
| The bounds bit works... but it slams the window to full screen. I sure
| could use some help offsetting the bounds.
|
| I have been playing with saving the height, top and left, then trying to
| dynamically resize the form on the secondary monitor as far as width
| goes, but I somehow always end up with it full screen, here is the code
| I have so far.
|
| If oLUConfig.HasBeenConfigured Then
| Me.Height = oLUConfig.IRHeight
| Me.Width = oLUConfig.IRWidth
| Me.Left = oLUConfig.IRLeft
| Me.Top = oLUConfig.IRTop
| If CheckForMultipleMonitors() AndAlso
| (oLUConfig.IRScreenDeviceName <> "") Then
| Dim s As Screen
| Dim bFound As Boolean = False
| Dim sName As String
|
| For Each s In Screen.AllScreens
| sName =oUtility.StripControlCharacters(s.DeviceName)
| If sName = oLUConfig.IRScreenDeviceName Then
| Me.SetDesktopBounds(Me.Left, Me.Top, Me.Width,
| Me.Height)
| bFound = True
| me.bounds = s.bounds
| me.setdesktopbounds(oluconfig.IRLeft, oluconfig.IRTop,
| oluconfig.IRWidth, oluconfig.IRHeight)
| Exit For
| End If
| Next
| If Not bFound Then
| Me.Bounds = Screen.PrimaryScreen.Bounds
| End If
| Else
| Me.Bounds = Screen.PrimaryScreen.Bounds
| End If
| Else
| Me.Height = 256
| Me.Width = Screen.PrimaryScreen.WorkingArea.Width
| Me.Top = iScreenHeight - Me.Height
| Me.Left = Screen.PrimaryScreen.WorkingArea.Left
| Me.SetDesktopBounds(Me.Left, Me.Top, Me.Width, Me.Height)
| End If
|
|
| Jay B. Harlow [MVP - Outlook] wrote:
| > Robert,
| > I normally set the bounds of the form to the bounds of the Screen
(monitor)
| > that I want the form to appear on.
| >
| > Something like:
| >
| > Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
| > Dim s As Screen
| > For Each s In Screen.AllScreens
| > If Not s.Primary Then Exit For
| > Next
| > Me.Bounds = s.Bounds
| > Me.WindowState = FormWindowState.Maximized
| > End Sub
| >
| > Will cause the form to appear "full screen" on the first secondary
monitor
| > if one is present.
| >
| > You should be able to use Rectangle.Location & Rectangle.Offset to
adjust
| > the bounds before you set them if you don't want a "full screen" window.
| > Post if you need help with offsetting the bounds.
| >
| > Hope this helps
| > Jay
| >
| > "Robert Porter" <rh******@noemail.nospam> wrote in message
| > news:O9*************@TK2MSFTNGP12.phx.gbl...
| > | That was perfect! Worked for me... Many thanks! Now you would not
happen
| > | to know how I can tell a form to appear, other than maximized, on a
| > | screen other than the primary display would you?
| > |
| > | Cheers,
| > |
| > | Bob Porter
| > |
| > | Jay B. Harlow [MVP - Outlook] wrote:
| > | > Robert,
| > | > It sounds like Screen.DeviceName contains an embedded and/or
trailing
| > Null
| > | > Chars (ControlChars.NullChar).
| > | >
| > | > Remember that ControlChars.NullChar is a valid System.String
character,
| > | > however most Win32 APIs, including the VS.NET debugger, treat it as
a
| > string
| > | > terminator.
| > | >
| > | > I would use either String.Trim or String.SubString to remove the
| > trailing
| > | > ControlChars.NullChar.
| > | >
| > | > Dim s As Screen
| > | > Dim deviceName As String
| > | >
| > | > Dim length As Integer =
| > | > s.DeviceName.IndexOf(ControlChars.NullChar)
| > | > If length = -1 Then
| > | > deviceName = s.DeviceName
| > | > Else
| > | > deviceName = s.DeviceName.Substring(0, length)
| > | > End If
| > | >
| > | > Hope this helps
| > | > Jay
| > | >
| > | > "Robert Porter" <rh******@noemail.nospam> wrote in message
| > | > news:e%*****************@TK2MSFTNGP10.phx.gbl...
| > | > |I have been experimenting with the Screen object. It has a property
| > | > | called Screen.DeviceName which returns a string value similar to
the
| > | > | following:
| > | > |
| > | > | \\.\DISPLAY1 or \\.\DISPLAY2
| > | > |
| > | > | I have 2 questions. When I assign the value to a class property
and
| > then
| > | > | serialize that class using a SoapFormatter I get a bunch of
garbage
| > | > | characters after the name. Console.Writeline does not display
these
| > | > | characters, but it does show a " in front of the string but not at
the
| > | > end?
| > | > |
| > | > | Secondly, I want my application to remember which monitor it was
| > | > | displayed on, and in what location and size etc.
| > | > |
| > | > | I have the size handled okay, and using SetDesktopBounds I can get
it
| > | > | back where it started, but cannot seem to figure out how to tell
it
| > | > | which monitor to use?
| > | > |
| > | > | Any help would be appreciated.
| > | > |
| > | > | Cheers,
| > | > |
| > | > | Robert Porter
| > | >
| > | >
| >
| >

Nov 21 '05 #9
Hi all,

Thanks for you Jay's elegant contribution in the community.
All will benefit from your suggestion. :)
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 21 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: KJM | last post by:
How can I detect if the user has dual monitors and then how do I control which monitor a form is displayed on. Currently my forms always come up on my right monitor. What if I want to have it...
0
by: Mingle | last post by:
Hi, all I am developing a program for displaying two pictures separately in two monitors ( A and B). The goal is: when the mouse pointer is pointed to a picture loaded in picturebox1 in A, a...
3
by: Frank Rizzo | last post by:
Is there anyway to be able to split vs.net between 2 monitors? For instance, on one monitor, I'd like to have the form in design mode, while the other monitor would have the code for the form. ...
2
by: Strah | last post by:
Is there a way to determine whether a computer is connected to dual monitors with VB.NET code? Thanks, Strah
3
by: fournij | last post by:
Hi I'm writing a MFC C++ application using Visual .NET. I'm using a Dual Head video card with 2 monitors. I want to start my application in the first monitor but open a dialog box in the...
0
by: Neji | last post by:
Is there a way to make a keyboard shortcut to change the mouse focus between dual monitors? For example, if I'm on the left-hand screen, would be able to hit a button combination that would change...
0
by: Neji | last post by:
Is it possible to switch between dual monitors with the keyboard? For example, if I am on the left-hand monitor, can I press a keyboard combination to teleport the mouse cursor to the middle of...
8
by: Sheldon | last post by:
I just received a 2nd (configured as a dual) monitor but, for Access only, I can't seem to figure out, if it's possible, to view, say, Table1 on one monitor and Table2 on the other monitor. If I...
2
by: Cindy | last post by:
I've been using dual monitors for about a year now (absolutely love it), but have run into a weird situation with Access 2000 lately. I loaded a database on two PC's that do NOT have dual...
3
by: kssnatha | last post by:
Hi, I have a issue when i open a popup in dual monitors. I opened a popup from my page using windows.open() method. During popup loading i used both moveTo and resizeTo methods. Its working fine...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.