Set selection mode from VB

Kevin
✭✭
in RobotStudio
The C# construct to set the selection mode to 'Surface' is:
[CODE]SetSelectionMode(SelectionModes.Surface);[/CODE]
I am trying to achieve the same result in VB.net under Visual Studio, but have been unable to discover the correct syntax.
My project has references to 'System.Drawing' and 'System.Windows.Forms' and includes the lines:
[CODE]Imports System.Drawing
Imports System.Windows.Forms[/CODE]
Thanks,
Kevin
[CODE]SetSelectionMode(SelectionModes.Surface);[/CODE]
I am trying to achieve the same result in VB.net under Visual Studio, but have been unable to discover the correct syntax.
My project has references to 'System.Drawing' and 'System.Windows.Forms' and includes the lines:
[CODE]Imports System.Drawing
Imports System.Windows.Forms[/CODE]
Thanks,
Kevin
0
Comments
-
The problem was due to an error in my conversion of SetSelectionMode from C# to VB.net.
Here is the working VB.net code converted from the C# example in the API help:
[CODE] ' This method sets the selection level.
Private Shared Sub SetSelectionMode(ByVal mode As SelectionModes)
' Go through all present windows.
For Each w As Window In UIEnvironment.Windows
' If there is a DocumentWindow that contains a GraphicControl
If (TypeOf w Is DocumentWindow) AndAlso (TypeOf w.Control Is GraphicControl) Then
' Set the SelectionMode.
Dim gc As GraphicControl = TryCast(w.Control, GraphicControl)
If gc IsNot Nothing Then
gc.Picker.SelectionMode = mode
End If
End If
Next
End Sub[/CODE]
This sub is called using the same construct as in C#:
[CODE]SetSelectionMode(SelectionModes.Surface)[/CODE]
This free on-line code converter did a better conversion than I managed:
http://www.developerfusion.com/tools/convert/csharp-to-vb/
Kevin
0
Categories
- All Categories
- 5.6K RobotStudio
- 399 UpFeed
- 20 Tutorials
- 14 RobotApps
- 301 PowerPacs
- 406 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 337 IRC5
- 67 OmniCore
- 8 RCS (Realistic Controller Simulation)
- 831 RAPID Programming
- 14 AppStudio
- 4 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 107 Collaborative Robots
- 5 Job listings