473,320 Members | 1,580 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How do you get a list of Datagrid names?

KC
How can I get a list of DataGrids used in my application? I could obviously
do this manually at design time, but I don't want to have to update the
list.

---
Ken
Nov 20 '05 #1
3 997

"KC" <yo*@dontneed.this> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
How can I get a list of DataGrids used in my application? I could obviously do this manually at design time, but I don't want to have to update the
list.


For Each c As Control In Controls
If TypeOf c Is DataGrid Then
' Add the name to your array
End If
Next
Nov 20 '05 #2
KC
Thank you. That helped a lot. But that example I've found assumes all my
datagrids are in the top 'Me' form. There's no easy way to get ALL the
controls in my app is there? I've got my stuff in panels in tabcontrols in
whatever....

Or will I just have to point it to the right subcontrols?

Ken

"Jeff Johnson [MVP: VB]" <i.***@enough.spam> wrote in message
news:OU**************@TK2MSFTNGP10.phx.gbl...

"KC" <yo*@dontneed.this> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
How can I get a list of DataGrids used in my application? I could

obviously
do this manually at design time, but I don't want to have to update the
list.


For Each c As Control In Controls
If TypeOf c Is DataGrid Then
' Add the name to your array
End If
Next

Nov 20 '05 #3
Hi,
Use recursion.

CheckForGrid(Me.Controls)

Private Sub CheckForGrid(ByVal ctrls As Control.ControlCollection)

For Each ctrl As Control In ctrls

If TypeOf ctrl Is DataGrid Then

Trace.WriteLine(DirectCast(ctrl, DataGrid).Name)

End If

CheckForGrid(ctrl.Controls)

Next

End Sub

Ken

---------------------------------

"KC" <yo*@dontneed.this> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Thank you. That helped a lot. But that example I've found assumes all my
datagrids are in the top 'Me' form. There's no easy way to get ALL the
controls in my app is there? I've got my stuff in panels in tabcontrols in
whatever....

Or will I just have to point it to the right subcontrols?

Ken

"Jeff Johnson [MVP: VB]" <i.***@enough.spam> wrote in message
news:OU**************@TK2MSFTNGP10.phx.gbl...

"KC" <yo*@dontneed.this> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> How can I get a list of DataGrids used in my application? I could

obviously
> do this manually at design time, but I don't want to have to update the
> list.


For Each c As Control In Controls
If TypeOf c Is DataGrid Then
' Add the name to your array
End If
Next


Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Ashish Shridharan | last post by:
Hi All I have been trying to add a control to the header cell of a datagrid on my ASP.NET page. These controls are defined in the HTML as ASP.NET web controls. They are being added into the...
0
by: Robert Brinson | last post by:
Hello all! I'm running .NET Framework 1.1 using VS.NET 2003. I've got a mystery with a DataGrid. Below is the definition of the DataGrid from my aspx page: </asp:datagrid><asp:datagrid...
2
by: Kathy Burke | last post by:
Hi, I'm doing a fairly simple datagrid (copied it from one that works). When I run the page, it gets and binds the datasource ok, but then I get an unhandled app error at End Sub. I've found this...
3
by: 2obvious | last post by:
I have a DataGrid containing a TextBox control and a CustomValidator in each row. The CustomValidator fires a function that compares all TextBoxes for equality. The algorithm for comparison is...
11
by: Fred Nelson | last post by:
I have an application in which it would be VERY beneficial if I could obtain the names of the colums in a datagrid. For example dim datagrid1 as new datagrid datagrid1.datasource = (stored...
12
by: Sam | last post by:
Hi, Do you know where I can find a simple example of what I'm trying to achieve : I have a dataset filled with two columns from a table of my database. Then the dataset is used to fill a...
4
by: cooltech77 | last post by:
Hi, I am trying to build the following functionality in the datagrid. I have a lot of columns in the datagrid which are being populated from the database and the user needs to scroll...
2
by: Charleees | last post by:
Hi all, I have a DataGrid with Template Columns..... There are LAbels,Linkbuttons in the Single Row.. I have to set the Constant Column width for those Template Columns in Grid... Wat...
0
by: weiwei | last post by:
Hi here is my scenario, I create a drop down list in itemtemplate.(that drop down is created from db), after user click edit command, my ideal plan is have another drop down list in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.