I'm fairly sure you actually want
Dim Screens() As System.Windows.Forms.Screen
(no s
at the end), as there isn't a Screens
type. The above line declares Screens
as an array of Screen
objects - now you can do
Screens = System.Windows.Forms.Screen.AllScreens
and do whatever it is you want to do with each Screen
.
edit not sure what reference problem you are still getting. From scratch, I start a new Windows Forms project, replace the code-behind in Form1
with this:
Public Class Form1
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Dim Screens() As System.Windows.Forms.Screen
Screens = System.Windows.Forms.Screen.AllScreens
For Each s As Screen In Screens
MessageBox.Show(s.DeviceName)
Next
End Sub
End Class
and it runs and does what I expect. This is VS2005 (not Express) but I can't imagine that would make a difference.