Compartilhar via


DataRepeater.SelectionColorChanged Event

Occurs when the SelectionColor property is changed.

Namespace:  Microsoft.VisualBasic.PowerPacks
Assembly:  Microsoft.VisualBasic.PowerPacks.Vs (in Microsoft.VisualBasic.PowerPacks.Vs.dll)

Syntax

'Declaration
Public Event SelectionColorChanged As EventHandler
public event EventHandler SelectionColorChanged
public:
 event EventHandler^ SelectionColorChanged {
    void add (EventHandler^ value);
    void remove (EventHandler^ value);
}
member SelectionColorChanged : IEvent<EventHandler,
    EventArgs>
JScript does not support events.

Remarks

Use this event to run code when the SelectionColor property of an item header is changed at run time.

For more information about how to handle events, see Consuming Events.

Examples

The following example demonstrates how to respond to the SelectionColorChanged event.

Private Sub DataRepeater1_SelectionColorChanged(
  ) Handles DataRepeater1.SelectionColorChanged
    Dim ColorString As String = DataRepeater1.SelectionColor.ToString
    Dim BracketPosition As Integer 
    ' Find the left bracket.
    BracketPosition = InStr(ColorString, "[")
    ' Find the color name.
    ColorString = Microsoft.VisualBasic.Right(ColorString, 
     Len(ColorString) - BracketPosition)
    ColorString = Microsoft.VisualBasic.Left(ColorString, 
     Len(ColorString) - 1)
    ' Display a message.
    MsgBox("Selections will be indicated by a " & ColorString &
       " header.")
End Sub
private void dataRepeater1_SelectionColorChanged(object sender, System.EventArgs e)
{
    StringBuilder MyStringBuilder = new StringBuilder(dataRepeater1.SelectionColor.ToString());
    string searchWithinThis = dataRepeater1.SelectionColor.ToString();
    // Find the color name. 
    string searchForThis = "[";
    int firstCharacter = searchWithinThis.IndexOf(searchForThis);
    MyStringBuilder.Remove(0, firstCharacter + 1);
    MyStringBuilder.Replace(']', ' ');

    // Display a message.
    MessageBox.Show("Selections will be indicated by a " + MyStringBuilder + "header.");
}

.NET Framework Security

See Also

Reference

DataRepeater Class

Microsoft.VisualBasic.PowerPacks Namespace

SelectionColor

Other Resources

Introduction to the DataRepeater Control (Visual Studio)