From Xojo Documentation

You are currently browsing the old Xojo documentation site. Please visit the new Xojo documentation site!

Read-Only Property (As Integer )
IntegerValue = aDesktopDisplay.LastDisplayIndex

New in 2021r3

Supported for all project types and targets.

The index of the last display connected to the user's computer. Display 0 is the main display. This can be useful when you need to loop through the user's displays.


This example finds the maximum screen depth of all displays connected to the user's computer:

Var maxDepth As Integer
For i As Integer = 0 To DesktopDisplay.LastDisplayIndex
Var currentDisplayDepth As Integer
currentDisplayDepth = DesktopDisplay.DisplayAt(i).ColorDepth
If currentDisplayDepth > maxDepth Then
maxDepth = currentDisplayDepth
End If