DataGridView.CellStateChanged Event
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Occurs when a cell state changes, such as when the cell loses or gains focus.
public:
event System::Windows::Forms::DataGridViewCellStateChangedEventHandler ^ CellStateChanged;
public event System.Windows.Forms.DataGridViewCellStateChangedEventHandler CellStateChanged;
public event System.Windows.Forms.DataGridViewCellStateChangedEventHandler? CellStateChanged;
member this.CellStateChanged : System.Windows.Forms.DataGridViewCellStateChangedEventHandler
Public Custom Event CellStateChanged As DataGridViewCellStateChangedEventHandler
Event Type
Examples
The following code example illustrates the use of this event.
private void dataGridView1_CellStateChanged(object sender,
DataGridViewCellStateChangedEventArgs e)
{
DataGridViewElementStates state = e.StateChanged;
string msg = String.Format("Row {0}, Column {1}, {2}",
e.Cell.RowIndex, e.Cell.ColumnIndex, e.StateChanged);
MessageBox.Show(msg, "Cell State Changed");
}
Private Sub dataGridView1_CellStateChanged(ByVal sender As Object, _
ByVal e As DataGridViewCellStateChangedEventArgs) _
Handles dataGridView1.CellStateChanged
Dim state As DataGridViewElementStates = e.StateChanged
Dim msg As String = String.Format( _
"Row {0}, Column {1}, {2}", _
e.Cell.RowIndex, e.Cell.ColumnIndex, e.StateChanged)
MessageBox.Show(msg, "Cell State Changed")
End Sub
Remarks
For more information about how to handle events, see Handling and Raising Events.
Applies to
See also
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET