Nullable プロパティを "Disallow" に設定すると、内容が空のセルをエンドユーザーが非アクティブ化したときに CellValidationError が発生します。これはセルの値を空にできない場合に役立ちます。Nullable プロパティを "DbNull" または "Nothing" に設定すると、それぞれ空のセルの値が DbNull.Value または null (VB では Nothing) と見なされます。Nullable プロパティを "EmptyString" に設定すると、空のセルの値が null ではなく string.Empty になります。Nullable プロパティを "Automatic" に設定すると、UltraTreeNodeColumn がデータバインドされている場合、基になる System.Data.DataColumn によって空のセルの値が決まります。この場合は、DataColumn の AllowDbNull プロパティによって空の値の扱われ方が決まります。
Imports Infragistics.Win Imports Infragistics.Win.UltraWinTree Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim columnQuantity As UltraTreeNodeColumn = Me.ultraTree1.ColumnSettings.ColumnSets("Order Details").Columns("Quantity") Dim columnDiscount As UltraTreeNodeColumn = Me.ultraTree1.ColumnSettings.ColumnSets("Order Details").Columns("Discount") Dim columnProduct As UltraTreeNodeColumn = Me.ultraTree1.ColumnSettings.ColumnSets("Order Details").Columns("ProductID") ' Set the 'Quantity' column to have a ForeColor of blue for ' the active cell, allow editing, and restrict the number of ' characters accepted for input so that the end user cannot ' enter a value greater than 99. Also, don't allow null values. columnQuantity.ActiveCellAppearance.ForeColor = Color.Blue columnQuantity.AllowCellEdit = AllowCellEdit.Full columnQuantity.MaxLength = 2 columnQuantity.Nullable = Nullable.Disallow ' make the 'Discount' column read-only. columnDiscount.AllowCellEdit = AllowCellEdit.ReadOnly ' Enable tooltips for the 'Product' column, since the ' name of the product might not always be fully visible. columnProduct.TipStyleCell = TipStyleCell.Show End Sub
using Infragistics.Win; using Infragistics.Win.UltraWinTree; using System.Diagnostics; private void button3_Click(object sender, System.EventArgs e) { UltraTreeNodeColumn columnQuantity = this.ultraTree1.ColumnSettings.ColumnSets["Order Details"].Columns["Quantity"]; UltraTreeNodeColumn columnDiscount = this.ultraTree1.ColumnSettings.ColumnSets["Order Details"].Columns["Discount"]; UltraTreeNodeColumn columnProduct = this.ultraTree1.ColumnSettings.ColumnSets["Order Details"].Columns["ProductID"]; // Set the 'Quantity' column to have a ForeColor of blue for // the active cell, allow editing, and restrict the number of // characters accepted for input so that the end user cannot // enter a value greater than 99. Also, don't allow null values. columnQuantity.ActiveCellAppearance.ForeColor = Color.Blue; columnQuantity.AllowCellEdit = AllowCellEdit.Full; columnQuantity.MaxLength = 2; columnQuantity.Nullable = Nullable.Disallow; // make the 'Discount' column read-only. columnDiscount.AllowCellEdit = AllowCellEdit.ReadOnly; // Enable tooltips for the 'Product' column, since the // name of the product might not always be fully visible. columnProduct.TipStyleCell = TipStyleCell.Show; }