This question is locked. New answers and comments are not allowed.
junk smith
Top achievements
Rank 1
junk smith
asked on 06 Aug 2009, 10:18 PM
I have a radtabstrip in a VB.NET project. examples to add and remove tabs have been noted and used.
using values from a database, tabs with unique names are created. how do i check whether the tab already exists prior to creating it?
Cheers
using values from a database, tabs with unique names are created. how do i check whether the tab already exists prior to creating it?
Cheers
5 Answers, 1 is accepted
0
Hi junk smith,
Thank you for writing. You can check if the tab item exists by implementing simple iteration over the Items collection. Or you can use Array.Exists method as well. Please, consider the following code:
I hope this helps. Do not hesitate to contact me again if you have other questions.
Sincerely yours,
Martin Vasilev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Thank you for writing. You can check if the tab item exists by implementing simple iteration over the Items collection. Or you can use Array.Exists method as well. Please, consider the following code:
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) |
If Array.Exists(Of RadItem)(Me.radTabStrip1.Items.ToArray(), FindItem) Then |
'do something... |
End If |
End Sub |
Private Shared Function FindItem(ByVal item As RadItem) As Boolean |
If item.Name.Equals("My_Tab_Name") Then |
Return True |
Else |
Return False |
End If |
End Function |
I hope this helps. Do not hesitate to contact me again if you have other questions.
Sincerely yours,
Martin Vasilev
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
junk smith
Top achievements
Rank 1
answered on 14 Aug 2009, 11:00 AM
Hi
Thanks for the reply, i came up with a different way;
For Each ti As TabItem In tabcontrol.Items
If ti.Name = TABNAMETOCHECK Then
TabExists = True
End If
Next
Thanks for the reply, i came up with a different way;
For Each ti As TabItem In tabcontrol.Items
If ti.Name = TABNAMETOCHECK Then
TabExists = True
End If
Next
0
Hello junk smith,
I am glad that you found a better approach for your application. Thank you for sharing it with the community.
Best wishes,
Nick
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
I am glad that you found a better approach for your application. Thank you for sharing it with the community.
Best wishes,
Nick
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
junk smith
Top achievements
Rank 1
answered on 14 Aug 2009, 03:50 PM
Only different, not necessarily better
Cheers
Cheers
0
Erwin
Top achievements
Rank 1
answered on 22 Oct 2009, 10:33 PM
Even better:
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) |
If Not Me.radTabStrip1.Items.SingleOrDefault(Function(s) s.Name.Equals("My_Tab_Name")) Is Nothing Then |
'do something... |
End If |
End Sub |
:-)
(Works starting from VB9).