Hi - I am sure I am not doing this right but not sure how it is done
I have an mdi parent with a rad ribbon bar on it. When I click a button on the ribbon bar it loads an child form. In the child form I have a rad treeview. But when the form loads the nodes do not show up. I can see the treeview, but the nodes do not populate
Public Sub New()
' This call is required by the designer.
InitializeComponent()
AddNodes()
' Add any initialization after the InitializeComponent() call.
End Sub
Private Sub AddNodes()
Me.MdiParent = Form1
Me.RadTreeView1.Parent = Form1
Dim Node1 As New RadTreeNode("Node1")
Node1.Tag = 1234
Node1.BackColor = Color.Blue
Dim Node2 As New RadTreeNode("Node2")
Dim Node3 As New RadTreeNode("Node3")
Dim Node4 As New RadTreeNode("Node4")
RadTreeView1.Nodes.Add(Node1)
RadTreeView1.Nodes.Add(Node2)
Node1.Nodes.Add(Node3)
Node2.Nodes.Add(Node4)
End Sub
I have an mdi parent with a rad ribbon bar on it. When I click a button on the ribbon bar it loads an child form. In the child form I have a rad treeview. But when the form loads the nodes do not show up. I can see the treeview, but the nodes do not populate
Public Sub New()
' This call is required by the designer.
InitializeComponent()
AddNodes()
' Add any initialization after the InitializeComponent() call.
End Sub
Private Sub AddNodes()
Me.MdiParent = Form1
Me.RadTreeView1.Parent = Form1
Dim Node1 As New RadTreeNode("Node1")
Node1.Tag = 1234
Node1.BackColor = Color.Blue
Dim Node2 As New RadTreeNode("Node2")
Dim Node3 As New RadTreeNode("Node3")
Dim Node4 As New RadTreeNode("Node4")
RadTreeView1.Nodes.Add(Node1)
RadTreeView1.Nodes.Add(Node2)
Node1.Nodes.Add(Node3)
Node2.Nodes.Add(Node4)
End Sub
3 Answers, 1 is accepted
0

Richard Slade
Top achievements
Rank 2
answered on 20 Mar 2011, 10:22 PM
Hi John,
Please can you move your code to populate the nodes to the FormLoad event, rather than in the constructor. I believe this is an issue which I have already reported to Telerik a couple of days ago. Please let me know if this helps
regards,
Richard
Please can you move your code to populate the nodes to the FormLoad event, rather than in the constructor. I believe this is an issue which I have already reported to Telerik a couple of days ago. Please let me know if this helps
regards,
Richard
0

John Reid
Top achievements
Rank 1
answered on 21 Mar 2011, 02:42 PM
Thanks Richard -
Unfortunately it did not work for me. Here is my child form load
Private Sub Operators_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.MdiParent = Form1
Me.RadTreeView1.Parent = Form1
Dim Node1 As New RadTreeNode("Node1")
Node1.Tag = 1234
Node1.BackColor = Color.Blue
Dim Node2 As New RadTreeNode("Node2")
Dim Node3 As New RadTreeNode("Node3")
Dim Node4 As New RadTreeNode("Node4")
RadTreeView1.Nodes.Add(Node1)
RadTreeView1.Nodes.Add(Node2)
Node1.Nodes.Add(Node3)
Node2.Nodes.Add(Node4)
End Sub
Unfortunately it did not work for me. Here is my child form load
Private Sub Operators_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.MdiParent = Form1
Me.RadTreeView1.Parent = Form1
Dim Node1 As New RadTreeNode("Node1")
Node1.Tag = 1234
Node1.BackColor = Color.Blue
Dim Node2 As New RadTreeNode("Node2")
Dim Node3 As New RadTreeNode("Node3")
Dim Node4 As New RadTreeNode("Node4")
RadTreeView1.Nodes.Add(Node1)
RadTreeView1.Nodes.Add(Node2)
Node1.Nodes.Add(Node3)
Node2.Nodes.Add(Node4)
End Sub
0
Accepted

Richard Slade
Top achievements
Rank 2
answered on 21 Mar 2011, 03:01 PM
Hello John,
Here is an example for you. the RadRibbonForm1 is the main form, and RadForm1 is the child form.
RadRibbonForm1 Designer
RadRibbonForm1.vb
RadForm1 Designer
RadForm1.vb
Hope that helps, but please let me know if you have any questions
Richard
Here is an example for you. the RadRibbonForm1 is the main form, and RadForm1 is the child form.
RadRibbonForm1 Designer
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial
Class
RadRibbonForm1
Inherits
Telerik.WinControls.UI.RadRibbonForm
'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()
Dim
resources
As
System.ComponentModel.ComponentResourceManager =
New
System.ComponentModel.ComponentResourceManager(
GetType
(RadRibbonForm1))
Me
.RadRibbonBar1 =
New
Telerik.WinControls.UI.RadRibbonBar()
Me
.RadStatusStrip1 =
New
Telerik.WinControls.UI.RadStatusStrip()
Me
.RibbonTab1 =
New
Telerik.WinControls.UI.RibbonTab()
Me
.RadRibbonBarGroup1 =
New
Telerik.WinControls.UI.RadRibbonBarGroup()
Me
.RadButtonElement1 =
New
Telerik.WinControls.UI.RadButtonElement()
CType
(
Me
.RadRibbonBar1, System.ComponentModel.ISupportInitialize).BeginInit()
CType
(
Me
.RadStatusStrip1, System.ComponentModel.ISupportInitialize).BeginInit()
CType
(
Me
, System.ComponentModel.ISupportInitialize).BeginInit()
Me
.SuspendLayout()
'
'RadRibbonBar1
'
Me
.RadRibbonBar1.AutoSize =
True
Me
.RadRibbonBar1.CommandTabs.AddRange(
New
Telerik.WinControls.RadItem() {
Me
.RibbonTab1})
Me
.RadRibbonBar1.Dock = System.Windows.Forms.DockStyle.Top
Me
.RadRibbonBar1.EnableKeyMap =
True
'
'
'
Me
.RadRibbonBar1.ExitButton.AccessibleDescription =
"Exit"
Me
.RadRibbonBar1.ExitButton.AccessibleName =
"Exit"
'
'
'
Me
.RadRibbonBar1.ExitButton.ButtonElement.AccessibleDescription =
"Exit"
Me
.RadRibbonBar1.ExitButton.ButtonElement.AccessibleName =
"Exit"
Me
.RadRibbonBar1.ExitButton.ButtonElement.
Class
=
"RadMenuButtonElement"
Me
.RadRibbonBar1.ExitButton.ButtonElement.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText
Me
.RadRibbonBar1.ExitButton.Text =
"Exit"
Me
.RadRibbonBar1.Location =
New
System.Drawing.Point(0, 0)
Me
.RadRibbonBar1.Name =
"RadRibbonBar1"
'
'
'
Me
.RadRibbonBar1.OptionsButton.AccessibleDescription =
"Options"
Me
.RadRibbonBar1.OptionsButton.AccessibleName =
"Options"
'
'
'
Me
.RadRibbonBar1.OptionsButton.ButtonElement.AccessibleDescription =
"Options"
Me
.RadRibbonBar1.OptionsButton.ButtonElement.AccessibleName =
"Options"
Me
.RadRibbonBar1.OptionsButton.ButtonElement.
Class
=
"RadMenuButtonElement"
Me
.RadRibbonBar1.OptionsButton.ButtonElement.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText
Me
.RadRibbonBar1.OptionsButton.Text =
"Options"
'
'
'
Me
.RadRibbonBar1.RootElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren
Me
.RadRibbonBar1.Size =
New
System.Drawing.Size(458, 144)
Me
.RadRibbonBar1.StartButtonImage =
CType
(resources.GetObject(
"RadRibbonBar1.StartButtonImage"
), System.Drawing.Image)
Me
.RadRibbonBar1.TabIndex = 0
Me
.RadRibbonBar1.Text =
"RadRibbonForm1"
'
'RadStatusStrip1
'
Me
.RadStatusStrip1.AutoSize =
True
Me
.RadStatusStrip1.LayoutStyle = Telerik.WinControls.UI.RadStatusBarLayoutStyle.Stack
Me
.RadStatusStrip1.Location =
New
System.Drawing.Point(0, 409)
Me
.RadStatusStrip1.Name =
"RadStatusStrip1"
Me
.RadStatusStrip1.Size =
New
System.Drawing.Size(458, 26)
Me
.RadStatusStrip1.SizingGrip =
False
Me
.RadStatusStrip1.TabIndex = 1
Me
.RadStatusStrip1.Text =
"RadStatusStrip1"
'
'RibbonTab1
'
Me
.RibbonTab1.AccessibleDescription =
"Tab 1"
Me
.RibbonTab1.AccessibleName =
"Tab 1"
Me
.RibbonTab1.Alignment = System.Drawing.ContentAlignment.BottomLeft
'
'RibbonTab1.ContentPanel
'
Me
.RibbonTab1.ContentPanel.BackColor = System.Drawing.SystemColors.ControlLightLight
Me
.RibbonTab1.ContentPanel.CausesValidation =
True
Me
.RibbonTab1.ContentPanel.Font =
New
System.Drawing.Font(
"Microsoft Sans Serif"
, 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
CType
(0,
Byte
))
Me
.RibbonTab1.ContentPanel.ForeColor = System.Drawing.SystemColors.ControlText
Me
.RibbonTab1.ContentPanel.Location =
New
System.Drawing.Point(0, 0)
Me
.RibbonTab1.ContentPanel.Size =
New
System.Drawing.Size(200, 100)
Me
.RibbonTab1.IsSelected =
True
Me
.RibbonTab1.Items.AddRange(
New
Telerik.WinControls.RadItem() {
Me
.RadRibbonBarGroup1})
Me
.RibbonTab1.Name =
"RibbonTab1"
Me
.RibbonTab1.StretchHorizontally =
False
Me
.RibbonTab1.Text =
"Tab 1"
Me
.RibbonTab1.Visibility = Telerik.WinControls.ElementVisibility.Visible
'
'RadRibbonBarGroup1
'
Me
.RadRibbonBarGroup1.AccessibleDescription =
"group 1"
Me
.RadRibbonBarGroup1.AccessibleName =
"group 1"
Me
.RadRibbonBarGroup1.Items.AddRange(
New
Telerik.WinControls.RadItem() {
Me
.RadButtonElement1})
Me
.RadRibbonBarGroup1.Name =
"RadRibbonBarGroup1"
Me
.RadRibbonBarGroup1.Text =
"group 1"
Me
.RadRibbonBarGroup1.Visibility = Telerik.WinControls.ElementVisibility.Visible
'
'RadButtonElement1
'
Me
.RadButtonElement1.AccessibleDescription =
"Click Me"
Me
.RadButtonElement1.AccessibleName =
"Click Me"
Me
.RadButtonElement1.
Class
=
"RibbonBarButtonElement"
Me
.RadButtonElement1.Name =
"RadButtonElement1"
Me
.RadButtonElement1.Text =
"Click Me"
Me
.RadButtonElement1.Visibility = Telerik.WinControls.ElementVisibility.Visible
'
'RadRibbonForm1
'
Me
.AutoScaleDimensions =
New
System.Drawing.SizeF(6.0!, 13.0!)
Me
.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me
.ClientSize =
New
System.Drawing.Size(458, 435)
Me
.Controls.Add(
Me
.RadStatusStrip1)
Me
.Controls.Add(
Me
.RadRibbonBar1)
Me
.IsMdiContainer =
True
Me
.Name =
"RadRibbonForm1"
'
'
'
Me
.RootElement.ApplyShapeToControl =
True
Me
.Text =
"RadRibbonForm1"
CType
(
Me
.RadRibbonBar1, System.ComponentModel.ISupportInitialize).EndInit()
CType
(
Me
.RadStatusStrip1, System.ComponentModel.ISupportInitialize).EndInit()
CType
(
Me
, System.ComponentModel.ISupportInitialize).EndInit()
Me
.ResumeLayout(
False
)
Me
.PerformLayout()
End
Sub
Friend
WithEvents
RadRibbonBar1
As
Telerik.WinControls.UI.RadRibbonBar
Friend
WithEvents
RadStatusStrip1
As
Telerik.WinControls.UI.RadStatusStrip
Friend
WithEvents
RibbonTab1
As
Telerik.WinControls.UI.RibbonTab
Friend
WithEvents
RadRibbonBarGroup1
As
Telerik.WinControls.UI.RadRibbonBarGroup
Friend
WithEvents
RadButtonElement1
As
Telerik.WinControls.UI.RadButtonElement
End
Class
RadRibbonForm1.vb
Public
Class
RadRibbonForm1
Private
Sub
RadButtonElement1_Click(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
RadButtonElement1.Click
Dim
form
As
New
RadForm1()
form.MdiParent =
Me
form.Show()
End
Sub
End
Class
RadForm1 Designer
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial
Class
RadForm1
Inherits
Telerik.WinControls.UI.RadForm
'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
.RadTreeView1 =
New
Telerik.WinControls.UI.RadTreeView()
CType
(
Me
.RadTreeView1, System.ComponentModel.ISupportInitialize).BeginInit()
CType
(
Me
, System.ComponentModel.ISupportInitialize).BeginInit()
Me
.SuspendLayout()
'
'RadTreeView1
'
Me
.RadTreeView1.Dock = System.Windows.Forms.DockStyle.Fill
Me
.RadTreeView1.Location =
New
System.Drawing.Point(0, 0)
Me
.RadTreeView1.Name =
"RadTreeView1"
Me
.RadTreeView1.Size =
New
System.Drawing.Size(252, 273)
Me
.RadTreeView1.TabIndex = 0
Me
.RadTreeView1.Text =
"RadTreeView1"
'
'RadForm1
'
Me
.AutoScaleDimensions =
New
System.Drawing.SizeF(6.0!, 13.0!)
Me
.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me
.ClientSize =
New
System.Drawing.Size(252, 273)
Me
.Controls.Add(
Me
.RadTreeView1)
Me
.Name =
"RadForm1"
'
'
'
Me
.RootElement.ApplyShapeToControl =
True
Me
.Text =
"RadForm1"
CType
(
Me
.RadTreeView1, System.ComponentModel.ISupportInitialize).EndInit()
CType
(
Me
, System.ComponentModel.ISupportInitialize).EndInit()
Me
.ResumeLayout(
False
)
End
Sub
Friend
WithEvents
RadTreeView1
As
Telerik.WinControls.UI.RadTreeView
End
Class
RadForm1.vb
Imports
Telerik.WinControls.UI
Public
Class
RadForm1
Private
Sub
RadForm1_Load(
ByVal
sender
As
System.
Object
,
ByVal
e
As
System.EventArgs)
Handles
MyBase
.Load
Dim
Node1
As
New
RadTreeNode(
"Node1"
)
Node1.Tag = 1234
Node1.BackColor = Color.Blue
Dim
Node2
As
New
RadTreeNode(
"Node2"
)
Dim
Node3
As
New
RadTreeNode(
"Node3"
)
Dim
Node4
As
New
RadTreeNode(
"Node4"
)
RadTreeView1.Nodes.Add(Node1)
RadTreeView1.Nodes.Add(Node2)
Node1.Nodes.Add(Node3)
Node2.Nodes.Add(Node4)
End
Sub
End
Class
Hope that helps, but please let me know if you have any questions
Richard