471,354 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

Preloading hashtable with object references..

Hope someone can help with this. I have a form with about
400 objects on it - most of them fall into two types: radio buttons and text

In the database, I have a table of values that, for each
item id (1, 2, 3...) there is an associated list of field
names (rbYes, rbNo, mskFirst, mskLast, mskQty). In my
form code, I have a LoadHashTable routine:

Dim Ctrl As Control
Dim SubCtrl As Control
For Each ctrl In Me.pnl01.controls
If Typeof Ctrl Is Panel Then
For Each SubCtrl In Ctrl.controls
gsHashTbl1.Add(Subctrl.Name, SubCtrl)
End If
If (Typeof Ctrl Is C1.Win.C1Input.C1TextBox) Then
gsHashTbl2.Add(SubCtrl.Name, SubCtrl)
End If

What I really need to do is pull the list of objects from
the database via an SP and then pre-load my hashtable
with object name and object type so I can reference them
dynamically in my FindControl subroutine - it's too much
of a hit to load this each and every time a user loads
this form.

My hashtable is declared as a global variable and I
think I should be able to do this, but I don't know how
to translate my LoadHashTable sub into something public.
The reason why is that I would not be iterating through
the pnl01 controls but through a datareader data set from
the database.

I tried several things, none of which worked. What I want
to do is this.

Dim rb As RadioButton
Tim tb As TextBox

For each row in datareader
If DataReader.Value(1) like "%rb%" THen
gsHashTable.Add(CtrlName, rb)
gsHashTable.Add(CtrlName, tb)
End If

What is it I'm missing here? TIA for any/all help
Jul 21 '05 #1
0 988

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Manish Jain | last post: by
3 posts views Thread by MioTheGreat | last post: by
2 posts views Thread by Noozer | last post: by
7 posts views Thread by J L | last post: by
2 posts views Thread by Ray Cassick \(Home\) | last post: by
7 posts views Thread by Keith Hughitt | last post: by
reply views Thread by XIAOLAOHU | last post: by

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.