DataGridColumnStyle.NullTextChanged 事件
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
發生於 NullText 值變更時。
public:
event EventHandler ^ NullTextChanged;
public event EventHandler NullTextChanged;
member this.NullTextChanged : EventHandler
Public Custom Event NullTextChanged As EventHandler
事件類型
範例
下列程式碼範例示範此成員的使用。
private:
void AddCustomColumnStyle()
{
myTableStyle = gcnew DataGridTableStyle;
myColumnStyle = gcnew DataGridTextBoxColumn;
myColumnStyle->NullTextChanged += gcnew EventHandler( this, &MyForm::columnStyle_NullTextChanged );
myTableStyle->GridColumnStyles->Add( myColumnStyle );
myDataGrid->TableStyles->Add( myTableStyle );
}
// NullTextChanged event handler of DataGridColumnStyle.
void columnStyle_NullTextChanged( Object^ /*sender*/, EventArgs^ /*e*/ )
{
for ( int i = 0; i < myRowcount; i++ )
{
myCell.RowNumber = i;
myDataGrid[ myCell ] = nullptr;
}
MessageBox::Show( "NullTextChanged Event is handled" );
}
private void AddCustomColumnStyle()
{
myTableStyle = new DataGridTableStyle();
myColumnStyle = new DataGridTextBoxColumn();
myColumnStyle.NullTextChanged += new EventHandler(columnStyle_NullTextChanged);
myTableStyle.GridColumnStyles.Add(myColumnStyle);
myDataGrid.TableStyles.Add(myTableStyle);
}
// NullTextChanged event handler of DataGridColumnStyle.
private void columnStyle_NullTextChanged(object sender, EventArgs e)
{
for(int i=0;i<myRowcount;i++)
{
myCell.RowNumber = i;
myDataGrid[myCell] = null;
}
MessageBox.Show("NullTextChanged Event is handled");
}
Private Sub AddCustomColumnStyle()
myTableStyle = New DataGridTableStyle()
myColumnStyle = New DataGridTextBoxColumn()
AddHandler myColumnStyle.NullTextChanged, AddressOf columnStyle_NullTextChanged
myTableStyle.GridColumnStyles.Add(myColumnStyle)
myDataGrid.TableStyles.Add(myTableStyle)
End Sub
' NullTextChanged event handler of DataGridColumnStyle.
Private Sub columnStyle_NullTextChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim i As Integer
For i = 0 To myRowcount - 1
myCell.RowNumber = i
myDataGrid(myCell) = Nothing
Next i
MessageBox.Show("NullTextChanged Event is handled")
End Sub