Here is a solution for you to show the error provider in the RadCommandBar and validate the RadCommandBarTextBox as required.
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial
Class
Form1
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
.components =
New
System.ComponentModel.Container()
Me
.RadCommandBar1 =
New
Telerik.WinControls.UI.RadCommandBar()
Me
.CommandBarRowElement1 =
New
Telerik.WinControls.UI.CommandBarRowElement()
Me
.CommandBarStripElement1 =
New
Telerik.WinControls.UI.CommandBarStripElement()
Me
.CommandBarTextBox1 =
New
Telerik.WinControls.UI.CommandBarTextBox()
Me
.RadButton1 =
New
Telerik.WinControls.UI.RadButton()
Me
.ErrorProvider1 =
New
System.Windows.Forms.ErrorProvider(
Me
.components)
Me
.CommandBarHostItem1 =
New
Telerik.WinControls.UI.CommandBarHostItem()
CType
(
Me
.RadCommandBar1, System.ComponentModel.ISupportInitialize).BeginInit()
CType
(
Me
.RadButton1, System.ComponentModel.ISupportInitialize).BeginInit()
CType
(
Me
.ErrorProvider1, System.ComponentModel.ISupportInitialize).BeginInit()
CType
(
Me
, System.ComponentModel.ISupportInitialize).BeginInit()
Me
.SuspendLayout()
'
'RadCommandBar1
'
Me
.RadCommandBar1.AutoSize =
True
Me
.RadCommandBar1.Dock = System.Windows.Forms.DockStyle.Top
Me
.RadCommandBar1.Location =
New
System.Drawing.Point(0, 0)
Me
.RadCommandBar1.Name =
"RadCommandBar1"
Me
.RadCommandBar1.Rows.AddRange(
New
Telerik.WinControls.UI.CommandBarRowElement() {
Me
.CommandBarRowElement1})
Me
.RadCommandBar1.Size =
New
System.Drawing.Size(292, 55)
Me
.RadCommandBar1.TabIndex = 0
Me
.RadCommandBar1.Text =
"RadCommandBar1"
'
'CommandBarRowElement1
'
Me
.CommandBarRowElement1.DisplayName =
Nothing
Me
.CommandBarRowElement1.MinSize =
New
System.Drawing.Size(25, 25)
Me
.CommandBarRowElement1.Strips.AddRange(
New
Telerik.WinControls.UI.CommandBarStripElement() {
Me
.CommandBarStripElement1})
'
'CommandBarStripElement1
'
Me
.CommandBarStripElement1.DisplayName =
"CommandBarStripElement1"
Me
.CommandBarStripElement1.FloatingForm =
Nothing
Me
.CommandBarStripElement1.Items.AddRange(
New
Telerik.WinControls.UI.RadCommandBarBaseItem() {
Me
.CommandBarTextBox1,
Me
.CommandBarHostItem1})
Me
.CommandBarStripElement1.Name =
"CommandBarStripElement1"
Me
.CommandBarStripElement1.StretchHorizontally =
False
Me
.CommandBarStripElement1.Text =
""
'
'CommandBarTextBox1
'
Me
.CommandBarTextBox1.AccessibleDescription =
"CommandBarTextBox1"
Me
.CommandBarTextBox1.AccessibleName =
"CommandBarTextBox1"
Me
.CommandBarTextBox1.DisplayName =
"CommandBarTextBox1"
Me
.CommandBarTextBox1.Name =
"CommandBarTextBox1"
Me
.CommandBarTextBox1.Text =
"CommandBarTextBox1"
Me
.CommandBarTextBox1.Visibility = Telerik.WinControls.ElementVisibility.Visible
'
'RadButton1
'
Me
.RadButton1.Location =
New
System.Drawing.Point(200, 48)
Me
.RadButton1.Name =
"RadButton1"
Me
.RadButton1.Size =
New
System.Drawing.Size(81, 24)
Me
.RadButton1.TabIndex = 1
Me
.RadButton1.Text =
"Submit"
'
'ErrorProvider1
'
Me
.ErrorProvider1.ContainerControl =
Me
'
'CommandBarHostItem1
'
Me
.CommandBarHostItem1.AccessibleDescription =
"CommandBarHostItem1"
Me
.CommandBarHostItem1.AccessibleName =
"CommandBarHostItem1"
Me
.CommandBarHostItem1.DisplayName =
"CommandBarHostItem1"
Me
.CommandBarHostItem1.Name =
"CommandBarHostItem1"
Me
.CommandBarHostItem1.Text =
"CommandBarHostItem1"
Me
.CommandBarHostItem1.Visibility = Telerik.WinControls.ElementVisibility.Visible
'
'Form1
'
Me
.AutoScaleDimensions =
New
System.Drawing.SizeF(6.0!, 13.0!)
Me
.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me
.ClientSize =
New
System.Drawing.Size(292, 84)
Me
.Controls.Add(
Me
.RadButton1)
Me
.Controls.Add(
Me
.RadCommandBar1)
Me
.Name =
"Form1"
'
'
'
Me
.RootElement.ApplyShapeToControl =
True
Me
.Text =
"Form1"
CType
(
Me
.RadCommandBar1, System.ComponentModel.ISupportInitialize).EndInit()
CType
(
Me
.RadButton1, System.ComponentModel.ISupportInitialize).EndInit()
CType
(
Me
.ErrorProvider1, System.ComponentModel.ISupportInitialize).EndInit()
CType
(
Me
, System.ComponentModel.ISupportInitialize).EndInit()
Me
.ResumeLayout(
False
)
Me
.PerformLayout()
End
Sub
Friend
WithEvents
RadCommandBar1
As
Telerik.WinControls.UI.RadCommandBar
Friend
WithEvents
CommandBarRowElement1
As
Telerik.WinControls.UI.CommandBarRowElement
Friend
WithEvents
CommandBarStripElement1
As
Telerik.WinControls.UI.CommandBarStripElement
Friend
WithEvents
RadButton1
As
Telerik.WinControls.UI.RadButton
Friend
WithEvents
ErrorProvider1
As
System.Windows.Forms.ErrorProvider
Friend
WithEvents
CommandBarTextBox1
As
Telerik.WinControls.UI.CommandBarTextBox
Friend
WithEvents
CommandBarHostItem1
As
Telerik.WinControls.UI.CommandBarHostItem
End
Class
Imports
Telerik.WinControls.UI
Imports
Telerik.WinControls
Imports
System.ComponentModel
Public
Class
Form1
Inherits
RadForm
''' <summary>
''' A windows text box that is hosted inside a CommandBarHostItem
''' </summary>
''' <remarks>Simply provides an anchor for the ErrorProvider to show</remarks>
Private
m_TextBox
As
TextBox
Public
Sub
New
()
InitializeComponent()
End
Sub
Private
Sub
Form1_Load(sender
As
System.
Object
, e
As
System.EventArgs)
Handles
MyBase
.Load
Me
.CommandBarStripElement1.StretchHorizontally =
True
' Host the windows textbox next to the real on
m_TextBox =
New
TextBox()
m_TextBox.Visible =
False
Me
.CommandBarHostItem1.HostedControl = m_TextBox
Me
.CommandBarHostItem1.AutoSize =
False
Me
.CommandBarHostItem1.Size =
New
Size(1,
Me
.CommandBarTextBox1.Size.Height)
' set the validation
AddHandler
CommandBarTextBox1.TextBoxElement.TextBoxItem.Validating,
AddressOf
CommandBarTextBox1_Validating
AddHandler
CommandBarTextBox1.TextBoxElement.TextBoxItem.Validated,
AddressOf
CommandBarTextBox1_Validated
Me
.CommandBarTextBox1.Text =
""
End
Sub
''' <summary>
''' If validated, then submit
''' </summary>
Private
Sub
RadButton1_Click(sender
As
System.
Object
, e
As
System.EventArgs)
Handles
RadButton1.Click
If
Me
.ValidateChildren()
Then
RadMessageBox.Show(
"Submit!"
)
End
If
End
Sub
''' <summary>
''' Validate the text of the CommandBarTextBox but put the errorprovider on the Windows TextBox
''' </summary>
Private
Sub
CommandBarTextBox1_Validating(
ByVal
sender
As
Object
,
ByVal
e
As
System.ComponentModel.CancelEventArgs)
If
Me
.CommandBarTextBox1.Text.Trim.Length = 0
Then
Me
.ErrorProvider1.SetError(m_TextBox,
"Provide a string"
)
e.Cancel =
True
End
If
End
Sub
''' <summary>
''' All good. It passes
''' </summary>
Private
Sub
CommandBarTextBox1_Validated(
ByVal
sender
As
Object
,
ByVal
e
As
EventArgs)
Me
.ErrorProvider1.SetError(m_TextBox,
""
)
End
Sub
End
Class
Hope this helps. Let me know if you have any questions. Remember to mark as answer if this solves your problem