Hello.
I am trying to create a tree where each node has an UltraNumericEditor column and a Label column. It's for "Quantity" and "Description", respectively. I'm having a hell of a time.
I am getting an error when adding the UltraNumericEditor.
Here's my code:
uTreeOptions.ViewStyle = ViewStyle.FreeForm Dim rootColumns As New UltraTreeColumnSet() rootColumns.Columns.Add("Qty") rootColumns.Columns.Add("Description") For Each row As DataRow In _dtOptions.Rows Dim _key As String = row("ContractSequence").ToString.Trim() Dim childNode As UltraWinTree.UltraTreeNode = uTreeOptions.Nodes.Add() childNode.Override.ColumnSet = rootColumns childNode.Cells("Qty").Value = 0 childNode.Cells("Qty").AllowEdit = AllowCellEdit.Full Dim wne As New UltraWinEditors.UltraNumericEditor() wne.Name = row("ContractSequence").ToString.Trim() wne.SpinButtonDisplayStyle = ButtonDisplayStyle.Always wne.MaxValue = 9 wne.MinValue = 0 wne.Nullable = False wne.MaskInput = "#" wne.MaskDisplayMode = UltraWinMaskedEdit.MaskMode.Raw wne.Value = 0 childNode.Override.ColumnSet.Columns("Qty").EditorComponent = wnechildNode.Cells("Description").Value = row("WebNarrative1").ToString().Trim() & " - " & CDbl(row("Price")).ToString("C")Next
Thanks in advance,
Mike
Hi Mike,
What's the error and on what line of code does it occur?
Also... this probably has nothing to do with the issue, but the code you have here is very inefficient. You are assigning the EditorComponent to the same ColumnSet every time you add a node. If you want every node to have the same structure, you only need to do this once. You also don't need to assign the ColumnSet to each individual node. And you should be using Grid style, not FreeForm.
Hi, Mike.
I was scrambling to get something working. I knew it wasn't correct.
What I'm trying to do is present a line-item list that contains an UltraNumericEditor column for a quantity, a Description column for a brief description, and a Price column. Only the quantity column (the UltraNumericEditor) should be input capable. Then, in a child node of the line item node, have a more detailed description of the item.
I've tried to set it up using the desinger and had it, but I could not get the UltraNumericEditor to allow input. I tried setting AllowCellEdit at just about every level, tried setting UseEditor to True just about everywhere, and still could not get it to go into edit mode.
Here's the Designer.vb file for a form that I whipped up to illustrate what I'm trying to do. If you copy/paste and run the app you won't be able to change the quantity.
Thanks for the help Mike.
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _Partial Class Form1 Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) Try If disposing AndAlso components IsNot Nothing Then components.Dispose() End If Finally MyBase.Dispose(disposing) End Try End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. <System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() Me.components = New System.ComponentModel.Container() Dim UltraTreeColumnSet1 As Infragistics.Win.UltraWinTree.UltraTreeColumnSet = New Infragistics.Win.UltraWinTree.UltraTreeColumnSet() Dim UltraTreeNodeColumn1 As Infragistics.Win.UltraWinTree.UltraTreeNodeColumn = New Infragistics.Win.UltraWinTree.UltraTreeNodeColumn() Dim UltraTreeNodeColumn2 As Infragistics.Win.UltraWinTree.UltraTreeNodeColumn = New Infragistics.Win.UltraWinTree.UltraTreeNodeColumn() Dim UltraTreeNodeColumn3 As Infragistics.Win.UltraWinTree.UltraTreeNodeColumn = New Infragistics.Win.UltraWinTree.UltraTreeNodeColumn() Dim Override1 As Infragistics.Win.UltraWinTree.Override = New Infragistics.Win.UltraWinTree.Override() Dim UltraTreeNode1 As Infragistics.Win.UltraWinTree.UltraTreeNode = New Infragistics.Win.UltraWinTree.UltraTreeNode() Dim Override2 As Infragistics.Win.UltraWinTree.Override = New Infragistics.Win.UltraWinTree.Override() Me.UltraNumericEditor1 = New Infragistics.Win.UltraWinEditors.UltraNumericEditor() Me.UltraTree1 = New Infragistics.Win.UltraWinTree.UltraTree() Me.UltraInkProvider1 = New Infragistics.Win.Ink.UltraInkProvider(Me.components) CType(Me.UltraNumericEditor1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.UltraTree1, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.UltraInkProvider1, System.ComponentModel.ISupportInitialize).BeginInit() Me.SuspendLayout() ' 'UltraNumericEditor1 ' Me.UltraNumericEditor1.Location = New System.Drawing.Point(31, 391) Me.UltraNumericEditor1.MaskInput = "#" Me.UltraNumericEditor1.MaxValue = 9 Me.UltraNumericEditor1.MinValue = 0 Me.UltraNumericEditor1.Name = "UltraNumericEditor1" Me.UltraNumericEditor1.Size = New System.Drawing.Size(112, 21) Me.UltraNumericEditor1.SpinButtonDisplayStyle = Infragistics.Win.ButtonDisplayStyle.Always Me.UltraNumericEditor1.SpinIncrement = 1 Me.UltraNumericEditor1.TabIndex = 1 ' 'UltraTree1 ' UltraTreeNodeColumn1.AllowCellEdit = Infragistics.Win.UltraWinTree.AllowCellEdit.Full UltraTreeNodeColumn1.DataType = GetType(Integer) UltraTreeNodeColumn1.EditorComponent = Me.UltraNumericEditor1 UltraTreeNodeColumn1.Key = "Qty" UltraTreeNodeColumn2.AllowCellEdit = Infragistics.Win.UltraWinTree.AllowCellEdit.Disabled UltraTreeNodeColumn2.DataType = GetType(String) UltraTreeNodeColumn2.Key = "Description" UltraTreeNodeColumn3.AllowCellEdit = Infragistics.Win.UltraWinTree.AllowCellEdit.Disabled UltraTreeNodeColumn3.DataType = GetType(String) UltraTreeNodeColumn3.Key = "Price" UltraTreeColumnSet1.Columns.Add(UltraTreeNodeColumn1) UltraTreeColumnSet1.Columns.Add(UltraTreeNodeColumn2) UltraTreeColumnSet1.Columns.Add(UltraTreeNodeColumn3) UltraTreeColumnSet1.Key = "rootLineItem" Me.UltraTree1.ColumnSettings.ColumnSets.Add(UltraTreeColumnSet1) Me.UltraTree1.ImageTransparentColor = System.Drawing.Color.Transparent Me.UltraTree1.Location = New System.Drawing.Point(31, 31) Me.UltraTree1.Name = "UltraTree1" Me.UltraTree1.NodeConnectorColor = System.Drawing.SystemColors.ControlDark Override1.ColumnSetIndex = 0 Override1.UseEditor = Infragistics.Win.DefaultableBoolean.[True] Me.UltraTree1.NodeLevelOverrides.Add(Override1) UltraTreeNode1.Text = "" Me.UltraTree1.Nodes.AddRange(New Infragistics.Win.UltraWinTree.UltraTreeNode() {UltraTreeNode1}) Override2.UseEditor = Infragistics.Win.DefaultableBoolean.[True] Me.UltraTree1.Override = Override2 Me.UltraTree1.Size = New System.Drawing.Size(647, 344) Me.UltraTree1.TabIndex = 0 Me.UltraTree1.ViewStyle = Infragistics.Win.UltraWinTree.ViewStyle.FreeForm ' 'UltraInkProvider1 ' Me.UltraInkProvider1.ContainingControl = Me ' 'Form1 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(706, 442) Me.Controls.Add(Me.UltraNumericEditor1) Me.Controls.Add(Me.UltraTree1) Me.Name = "Form1" Me.Text = "Form1" CType(Me.UltraNumericEditor1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.UltraTree1, System.ComponentModel.ISupportInitialize).EndInit() CType(Me.UltraInkProvider1, System.ComponentModel.ISupportInitialize).EndInit() Me.ResumeLayout(False) Me.PerformLayout() End Sub Friend WithEvents UltraTree1 As Infragistics.Win.UltraWinTree.UltraTree Friend WithEvents UltraNumericEditor1 As Infragistics.Win.UltraWinEditors.UltraNumericEditor Friend WithEvents UltraInkProvider1 As Infragistics.Win.Ink.UltraInkProvider End Class
Sure thing. See attached.
BTW, I got it to work by setting the Override.CellClickAction property of the UltraTreeView control to CellClickAction.EditCell.
I don't understand why I needed to do this.
In any event can you take a quick look and tell me if what I did is a good/correct way of doing it?
Thanks again,
That's correct, you have to set CellClickAction to be able to edit a cell.
I thought you said you were getting some kind of error when you assigned the editor, though. That's the problem I was trying to help you resolve.
Anyway, your sample looks fine to me.
Hi, Mike. Sorry for the confusion.
I was getting an error when I was programmatically setting up the WinTree.
That went away when I used the designer to set up the WinTree and removed the code.
Hello,
I am just checking did you solve your issue accordingly to the information that Michael provided you?
Let me know if you need any further assistance.
Yes. Thank you.