Selected IndexChanged Event Handler

You can write code in the SelectedIndexChanged event handler to show the value of the currently selected range in a text box on the actions pane, as shown in Listing 7.34.

Listing 7.34. Displaying the current value of the list object in the actions pane Dim myTextbox As New TextBox

Private Sub List1_SelectedIndexChanged(ByVal sender As _ Object, ByVal e As System.EventArgs) Handles _ List1.SelectedIndexChanged

Globals.ThisWorkbook.ActionsPane.Controls.Add(myTextbox) Dim currentRange As Excel.Range = Me.Application.Selection myTextbox.Text = currentRange.Text

End Sub

0 0

Post a comment