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