# How to find the control having Width \< 10

**URL:** <https://forum.xojo.com/t/how-to-find-the-control-having-width-10/27859>\
**Category:** General\
**Created:** [November 6, 2015, 2:33am UTC](https://forum.xojo.com/t/how-to-find-the-control-having-width-10/27859 "2015-11-06T02:33:07Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![changwon\_lee](https://forum.xojo.com/letter_avatar_proxy/v4/letter/c/97f17d/32.png) [@changwon\_lee](https://forum.xojo.com/u/changwon_lee)\
**Post date:** [November 6, 2015, 2:33am UTC](https://forum.xojo.com/t/how-to-find-the-control-having-width-10/27859/1 "2015-11-06T02:33:07Z")

</div>

Hi,

I seems to be very weird question though.  
Is there any way to find the control having Width \< 10?

---

<div class="post-metadata">

**Author:** ![Mike\_D](https://forum.xojo.com/user_avatar/forum.xojo.com/mike_d/32/266_2.png) [@Mike\_D](https://forum.xojo.com/u/Mike_D)\
**Post date:** [November 6, 2015, 3:35am UTC](https://forum.xojo.com/t/how-to-find-the-control-having-width-10/27859/2 "2015-11-06T03:35:15Z")

</div>

you can iterate over all controls on a window, example here: [http://documentation.xojo.com/index.php/Window.Control](http://documentation.xojo.com/index.php/Window.Control)

---

<div class="post-metadata">

**Author:** ![changwon\_lee](https://forum.xojo.com/letter_avatar_proxy/v4/letter/c/97f17d/32.png) [@changwon\_lee](https://forum.xojo.com/u/changwon_lee)\
**Post date:** [November 6, 2015, 2:35pm UTC](https://forum.xojo.com/t/how-to-find-the-control-having-width-10/27859/3 "2015-11-06T14:35:21Z")

</div>

It seems that there is no width property in control(i). I got error saying 'Type Control has no member named “width” ’  
How can I use ‘width’?

[code]  
Dim c As Control  
For i As Integer = 0 To Self.ControlCount-1

```
If MainWindow.RepScreen.Control(i).width < 10 Then
  
  MsgBox " Control name : " + MainWindow.RepScreen.Control(i).Name
End If

```

Next[/code]

---

<div class="post-metadata">

**Author:** ![Mark\_Walsh](https://forum.xojo.com/letter_avatar_proxy/v4/letter/m/c77e96/32.png) [@Mark\_Walsh](https://forum.xojo.com/u/Mark_Walsh)\
**Post date:** [November 6, 2015, 2:41pm UTC](https://forum.xojo.com/t/how-to-find-the-control-having-width-10/27859/4 "2015-11-06T14:41:19Z")

</div>

I can’t look into this right now, but you will probably need to check if the control is a RectControl

---

<div class="post-metadata">

**Author:** ![Paul\_Lefebvre](https://forum.xojo.com/user_avatar/forum.xojo.com/paul_lefebvre/32/3152_2.png) [@Paul\_Lefebvre](https://forum.xojo.com/u/Paul_Lefebvre)\
**Post date:** [November 6, 2015, 2:41pm UTC](https://forum.xojo.com/t/how-to-find-the-control-having-width-10/27859/5 "2015-11-06T14:41:44Z")

</div>

Control doesn’t have a Width property, but RectControl does. You need to check if the control is a RectControl and then cast it to get to the Width property:

`If MainWindow.RepScreen.Control(i) IsA RectControl Then
  If RectControl(MainWindow.RepScreen.Control(i)).Width < 10 Then`

---

<div class="post-metadata">

**Author:** ![changwon\_lee](https://forum.xojo.com/letter_avatar_proxy/v4/letter/c/97f17d/32.png) [@changwon\_lee](https://forum.xojo.com/u/changwon_lee)\
**Post date:** [November 6, 2015, 2:54pm UTC](https://forum.xojo.com/t/how-to-find-the-control-having-width-10/27859/6 "2015-11-06T14:54:13Z")

</div>

It works well !! Thank you.

```auto
  Dim c As Control
  For i As Integer = 0 To Self.ControlCount-1
    
    If MainWindow.RepScreen.Control(i) IsA RectControl Then
      'If RectControl(MainWindow.RepScreen.Control(i)).Width < 50 Then
      If RectControl(MainWindow.RepScreen.Control(i)).Height < 10 Then
        MsgBox " Control name : " + RectControl(MainWindow.RepScreen.Control(i)).name
      End If
    End IF
  Next
```

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 6:02pm UTC](https://forum.xojo.com/t/how-to-find-the-control-having-width-10/27859/7 "2020-10-29T18:02:47Z")

</div>


