FlowLayoutPanel.

Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
11 posts Page 1 of 2
Contributors
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

FlowLayoutPanel.
Dummy1912
Hello,

I was wondering if someone can help us out (we use vb 2013 .net)
we have a few controls into this flowlayoutpanel
and we have a textbox that we wanna use for search.

So we like to get the current search of the textbox that maybe exist in the flowlayoutpanel
when we search for a Description and if the flowlayoutpanel contains the controls that has the Description then it will remove the rest and show only that part that has the Description

with short words we like to create a search part to get the controls that has this description of the search.

for example we have 100 Controls
and with different descriptions

Codenstuff Test
Danny Demo
Flow by me
Duck
Cat
Mouse

and when we type into the textbox : D or Danny Demo
it will show only the controls that has the textbox search.

hope this helps :)

Thank you.
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
CodenStuff
Site Admin
Site Admin
Posts: 4389
Joined: Tue Aug 04, 2009 1:47 am

Re: FlowLayoutPanel.
CodenStuff
This may help.

Using a textbox to search for a specific control by name, example "Button4", it will display a message box with the contorls Tag property if it finds it.
Code: Select all
Dim FLControls As Control() = FlowLayoutPanel1.Controls.Find(TextBox1.Text, False)
        For Each FLC As Control In FLControls
            MsgBox(FLC.Tag)
        Next
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: FlowLayoutPanel.
Dummy1912
Hi #CodenStuff

Thanks for the reply
i will look into it and keep you posted

Thanks loove;
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: FlowLayoutPanel.
Dummy1912
Hello Again,
I have tested it but isn't working
is it possible to get from the control his label.text to search on?
Code: Select all
' the control is
Dim FLControls As MetroDetailBar() = BorderPanel1.Controls.Find(txtsearch.Text, False)
thanks
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
comathi
Coding God
Coding God
Posts: 1242
Joined: Fri Mar 26, 2010 1:59 pm

Re: FlowLayoutPanel.
comathi
According to MSDN's documentation, the Find() method finds controls by name, if you want to search controls according to text in one of their labels, it'll be a bit more complicated, but it's still possible in theory.

However, I suggest that instead, you dynamically change the name of your controls when you add them to your FlowLayoutPanel so that you can use the function Craig posted... it's probably much more efficient than any method with labels cooll;
User avatar
Smiley
VIP - Donator
VIP - Donator
Posts: 269
Joined: Sat Dec 19, 2009 3:39 pm

Re: FlowLayoutPanel.
Smiley
Hi Dummy give this little test app a look and let me know if it helps
flowlayoutsearh.zip
Smiley cooll;
You do not have the required permissions to view the files attached to this post.
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: FlowLayoutPanel.
Dummy1912
Thanks my dear #Smiley
i keep you posted ;)
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: FlowLayoutPanel.
Dummy1912
sorry #Smiley,
but does not work
all controls has been loaded but search dpn't work
even with a msgbox as result no popup :(
Code: Select all
Private Sub btnsearch_Click(sender As Object, e As EventArgs) Handles btnsearch.Click
        Try
            'Dim FLControls As MetroDetailBar() = BorderPanel1.Controls.Find(txtsearch.Text, False)
            'For Each FLC As MetroDetailBar In FLControls
            '    MsgBox(FLC.Text)
            'Next

            Dim match As Boolean = False
            For Each item As MetroDetailBar In BorderPanel1.Controls
                If item.Text = txtsearch.Text Then
                    match = True
                End If
            Next
            If match = True Then
                For Each del As MetroDetailBar In BorderPanel1.Controls
                    If del.Text = txtsearch.Text Then
                        MsgBox(del.Text)
                    Else
                        del.Dispose()
                    End If
                Next
            End If
        Catch ex As Exception
            Exit Sub
        End Try

    End Sub
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
Smiley
VIP - Donator
VIP - Donator
Posts: 269
Joined: Sat Dec 19, 2009 3:39 pm

Re: FlowLayoutPanel.
Smiley
Dummy1912 wrote:
sorry #Smiley,
but does not work
all controls has been loaded but search dpn't work
even with a msgbox as result no popup :(
Code: Select all
Private Sub btnsearch_Click(sender As Object, e As EventArgs) Handles btnsearch.Click
        Try
            'Dim FLControls As MetroDetailBar() = BorderPanel1.Controls.Find(txtsearch.Text, False)
            'For Each FLC As MetroDetailBar In FLControls
            '    MsgBox(FLC.Text)
            'Next

            Dim match As Boolean = False
            For Each item As MetroDetailBar In BorderPanel1.Controls
                If item.Text = txtsearch.Text Then
                    match = True
                End If
            Next
            If match = True Then
                For Each del As MetroDetailBar In BorderPanel1.Controls
                    If del.Text = txtsearch.Text Then
                        MsgBox(del.Text)
                    Else
                        del.Dispose()
                    End If
                Next
            End If
        Catch ex As Exception
            Exit Sub
        End Try

    End Sub
When you add the controls make sure each MetroDetailbar.Tag = "whatever item it is"
then change the if statements to check for item tag instead of item text.

If that doesnt work i would be happy to take a look at the source to the application your building.

Smiley, cooll;
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: FlowLayoutPanel.
Dummy1912
Sorry #Smiley
but this didn't worked :(
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
11 posts Page 1 of 2
Return to “Tutorial Requests”