DataGridColumnStyle.CheckValidDataSource(CurrencyManager) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
如果 DataGrid 沒有有效的資料來源,或者這個資料行並未對應至資料來源的有效屬性,則會擲回例外狀況。
protected:
void CheckValidDataSource(System::Windows::Forms::CurrencyManager ^ value);
protected void CheckValidDataSource (System.Windows.Forms.CurrencyManager value);
member this.CheckValidDataSource : System.Windows.Forms.CurrencyManager -> unit
Protected Sub CheckValidDataSource (value As CurrencyManager)
參數
- value
- CurrencyManager
要檢查的 CurrencyManager。
例外狀況
value
為 null
。
這個資料行的 PropertyDescriptor 為 null
。
範例
下列程式碼範例會取得 CurrencyManager 資料來源的 ,並使用 CheckValidDataSource 來判斷 是否 CurrencyManager 有效。
private:
void CheckCurrencyManager( CurrencyManager^ myCurrencyManager )
{
// This code is from a class named MyDataGridColumnStyle derived
// from DataGridColumnStyle.
MyDataGridColumnStyle^ myGridColumn = this;
try
{
myGridColumn->CheckValidDataSource( myCurrencyManager );
}
catch ( ArgumentNullException^ e )
{
Console::WriteLine( e->Message );
}
catch ( ApplicationException^ e )
{
Console::WriteLine( e->Message );
}
}
private void CheckCurrencyManager(CurrencyManager myCurrencyManager) {
// This code is from a class named MyDataGridColumnStyle derived
// from DataGridColumnStyle.
MyDataGridColumnStyle myGridColumn = this;
try {
myGridColumn.CheckValidDataSource(myCurrencyManager);
}
catch (ArgumentNullException e) {
Console.WriteLine(e.Message);
}
catch (ApplicationException e) {
Console.WriteLine(e.Message);
}
}
Private Sub CheckCurrencyManager(myCurrencyManager As CurrencyManager)
' This code is from a class named MyDataGridColumnStyle derived
' from DataGridColumnStyle.
Dim myGridColumn As MyDataGridColumnStyle = Me
Try
myGridColumn.CheckValidDataSource(myCurrencyManager)
Catch e As ArgumentNullException
Console.WriteLine(e.Message)
Catch e As ApplicationException
Console.WriteLine(e.Message)
End Try
End Sub