Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to make a function that deletes all pictureboxes at a certain location.
Right now i have this
VB
Public Function ClearTaskBar()
    For Each ctrl In Controls
        If ctrl =  Then


        End If
    Next
End Function

and i do not know how to use the location of those controls as arguments.
Does anyone know how to do this?
Posted
Comments
[no name] 28-Jul-15 12:04pm    
The location as arguments to what? You might find if helpful to read the documentation, https://msdn.microsoft.com/en-us/library/system.windows.forms.control.location(v=vs.110).aspx
Member 11852402 28-Jul-15 12:11pm    
an argument like: if ctrl.location = (0, 0) Then
[no name] 28-Jul-15 12:17pm    
That is not an argument. You would check the X and Y values of the location's point.
Member 11852402 28-Jul-15 14:15pm    
i know it isnt an argument but is it possible to do something like that
[no name] 28-Jul-15 20:27pm    
If you know then why did you ask?

1 solution

It should be coded like this :
VB
Public Function ClearTaskBar()
     For Each ctrl as control In Controls
         If ctrl.visible  Then
            ' do something
         End If
         If ctrl.location.X=0 andalso ctrl.location.Y=0 Then
            ' do something
         End If
     Next
 End Function


Now you have to decide what to do with the "crtl" ...

... but "crtl" only is accessible as control - either if it is a Button or a Lable or whatever ...
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900