tabcontrol Search

bharanidharanit

Well-known member
Joined
Dec 8, 2008
Messages
53
Location
India
Programming Experience
1-3
Hello sir,
I am using Visual studio 2005.
I am having more link labels on a form under a tabbed control.
I want to search for certain linklabels in a form. So i used the coding below, But it is displaying the search in the corresponding tabs itself. But i want my search to be displayed in new tab under the same tabbed control.
Can anyone help me in this?

VB.NET:
Private Sub Button1_Click( _
    ByVal sender As System.Object, _
    ByVal e As System.EventArgs _
) Handles Button1.Click
 
 
        For Each page As TabPage In Me.TabControl1.TabPages
            For Each ctl As Control In page.Controls
                If TypeOf ctl Is LinkLabel Then
                    ctl.Visible = (ctl.Text.IndexOf(txtSearch.Text, StringComparison.CurrentCultureIgnoreCase) <> -1)
                End If
            Next
        Next
    End Sub
 
But i want my search to be displayed
What is it you want to display?

As for a "search results" tabpage, you probably want to design it first in Designer. Then you can use code to temporarily remove/add it to display the results later.
 
What is it you want to display?

As for a "search results" tabpage, you probably want to design it first in Designer. Then you can use code to temporarily remove/add it to display the results later.

Actually Consider this sir,
I am having these link labels
aaa in tab1 (TabController1)
bbb in tab2 (TabController1)
aaaa in tab3 (TabController1)
So When i search for "aaa" means it display both "aaa" and "aaaa" in the corresponding tab itself (ie) in tab1 and tab3.
But i want them to be displayed in new tab (tab4)

Hope you can get me!
 
If you want to add these controls to that tabpage it's:
VB.NET:
tab4.Controls.Add(ctl)
You also have to set the controls Location if necessary.
Note it is a move operation since a control object can only have one parent.
 
Back
Top