次の方法で共有


DataRepeater.SelectionColorChanged イベント

SelectionColor プロパティが変更されると発生します。

名前空間:  Microsoft.VisualBasic.PowerPacks
アセンブリ:  Microsoft.VisualBasic.PowerPacks.Vs (Microsoft.VisualBasic.PowerPacks.Vs.dll 内)

構文

'宣言
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 では、イベントは使用できません。

解説

項目ヘッダーの SelectionColor のプロパティが実行時に変更されたときにコードを実行するには、このイベントを使用します。

イベントの処理方法の詳細については、「イベントの利用」を参照してください。

次の例に SelectionColorChanged のイベントに応答する方法を示しています。

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 セキュリティ

  • 直前の呼び出し元に対する完全な信頼。このメンバーは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

関連項目

DataRepeater クラス

Microsoft.VisualBasic.PowerPacks 名前空間

SelectionColor

その他の技術情報

DataRepeater コントロールの概要 (Visual Studio)