# get datagridview on tabpage dynamically

**URL:** <https://forums.powershell.org/t/get-datagridview-on-tabpage-dynamically/15014>\
**Category:** PowerShell Help\
**Created:** [September 27, 2020, 3:42am UTC](https://forums.powershell.org/t/get-datagridview-on-tabpage-dynamically/15014 "2020-09-27T03:42:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![paddy75](https://avatars.discourse-cdn.com/v4/letter/p/35a633/32.png) [@paddy75](https://forums.powershell.org/u/paddy75)\
**Post date:** [September 27, 2020, 3:42am UTC](https://forums.powershell.org/t/get-datagridview-on-tabpage-dynamically/15014/1 "2020-09-27T03:42:51Z")

</div>

Hello all,

hope someone can assist me with my problem.  
I have a tabcontrol with some tabpages. Not all have a datagridview on it. At the button of the form is a toolstripstatuslabel.   
What I want to do now is, when I switch the tabpage –\> check if there is a datagridview –\> count the lines from it and display the result in the toostripstatuslabel.  
At the moment I have a “SelectedIndexChanged” for the tabcontrol which clears the toolstripstatuslabel. But this is not so nice because if I switch the pages, I have to run my queries again to get my results back in the toolstripstatuslabel.  
My problem is now how can I check if a datagridview is present or not?

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:28pm UTC](https://forums.powershell.org/t/get-datagridview-on-tabpage-dynamically/15014/2 "2024-05-16T20:28:51Z")

</div>


