Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / DataGrid / January 2005

Tip: Looking for answers? Try searching our database.

Casting a grid

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
et - 31 Jan 2005 12:36 GMT
I have a web form with several grids on it, and a procedure that cycles
through each grid to do a number of tasks, using for next, and am getting a
"Specified cast is not valid" error when I attempted to put the grid names
in an arraylist.

For sample purposes, we'll name the grids grid1, grid2, grid3.

when I manually set each grid, it works fine:

       dg = grid1
       GetData(dg)
       dg = grid2
       GetData(dg)
       dg=grid3
       GetData(dg)

but when I attempted to put the grids in an arraylist, I get the cast error:

   arrGrids.add("grid1")
   arrGrids.add("grid2")
   arrGrids.add("grid3")

   for i = 0 to arrGrids.Count-1
       dg = ctype(arrGrids(i), DataGrid)
       GetData(dg)
   next

How else can I do this?  tia
Eliyahu Goldin - 31 Jan 2005 13:16 GMT
arrGrids.add("grid1") adds a string "grid1".

arrGrids.add(grid1) will add the object grid1.

Eliyahu

> I have a web form with several grids on it, and a procedure that cycles
> through each grid to do a number of tasks, using for next, and am getting a
[quoted text clipped - 24 lines]
>
> How else can I do this?  tia
et - 31 Jan 2005 15:00 GMT
Don't know why I didn't catch that one, thanks!  Must be a Monday.  That did
the trick.
> arrGrids.add("grid1") adds a string "grid1".
>
[quoted text clipped - 33 lines]
>>
>> How else can I do this?  tia

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.