How to: Enable Tabbing Between Shapes
Line and shape controls do not have TabStop or TabIndex properties, but you can still enable tabbing among them.
Your computer might show different names or locations for some of the Visual Studio user interface elements in the following instructions. The Visual Studio edition that you have and the settings that you use determine these elements. For more information, see Visual Studio Settings.
To enable tabbing among shapes
In the Code Editor, add an Imports statement at the top of the module:
Add the following code in an event procedure:
Private Sub Shapes_PreviewKeyDown(ByVal sender As Object, _ ByVal e As System.Windows.Forms.PreviewKeyDownEventArgs) Handles _ RectangleShape1.PreviewKeyDown, RectangleShape2.PreviewKeyDown, _ RectangleShape3.PreviewKeyDown Dim sh As Shape ' Check for the Control and Tab keys. If e.KeyCode = Keys.Tab And e.Modifiers = Keys.Control Then ' Find the next shape in the order. sh = ShapeContainer1.GetNextShape(sender, True) ' Select the next shape. ShapeContainer1.SelectNextShape(sender, False, True) End If End Sub
Add the following code in the Button1_PreviewKeyDown event procedure:
Private Sub Button1_PreviewKeyDown(ByVal sender As Object, _ ByVal e As System.Windows.Forms.PreviewKeyDownEventArgs) _ Handles Button1.PreviewKeyDown ' Check for the Control and Tab keys. If e.KeyCode = Keys.Tab And e.Modifiers = Keys.Control Then ' Select the first shape. RectangleShape1.Select() End If End Sub