DataGridColumnStyle.EnterNullValue 方法

向列中输入 DBNull.Value

**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)

语法

声明
Protected Friend Overridable Sub EnterNullValue
用法

Me.EnterNullValue
protected internal virtual void EnterNullValue ()
protected public:
virtual void EnterNullValue ()
protected void EnterNullValue ()
protected internal function EnterNullValue ()

备注

当用户按下 Alt+0 时调用此方法,这样可允许向列中输入适当的空值。例如,当在 DataGridTextBoxColumn 上调用时,将向该列中插入适当的 NullText 值。

EnterNullValue 没有默认行为。当从 DataGridColumnStyle 继承时,请重写该方法以在列中输入 空引用(在 Visual Basic 中为 Nothing)。

示例

下面的代码示例演示 EnterNullValue 方法的一种重写。

Overrides Protected Sub EnterNullValue()
   ' Enter the NullText value into a hosted TextBox control.
   Me.TextBox.Text = Me.NullText
End Sub

平台

Windows 98、Windows 2000 SP4、Windows CE、Windows Millennium Edition、Windows Mobile for Pocket PC、Windows Mobile for Smartphone、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

DataGridColumnStyle 类
DataGridColumnStyle 成员
System.Windows.Forms 命名空间
NullText
NullTextChanged