Logo 
Search:

Asp.net Forum

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds

Dynamic Variable Name creation

  Asked By: Chisisi    Date: Aug 06    Category: Asp.net    Views: 2571
  

I'm creating a VB.net program that will not have any interface and
will be run as a windows service, so i can't rely on any GUI objects.
I need to monitor several pionts, i get their information from the
database.
Now for each of these , say they're a list of Strings unique.
I wish to create a variable for each name i get from the database eg..

Dim dbresult as string
dbresult = "forexample"

'ok now here i wanna dynamically create the name

Dim ToString(dbresult) as String
'or is there a better way of doing this? i can't seem to find any
such info online.

Share: 

 

2 Answers Found

 
Answer #1    Answered By: Wilbur Hall     Answered On: Aug 06

This discussion thread might help you out...

www.dotnet247.com/247reference/msgs/10/51846.aspx

 
Answer #2    Answered By: Chione Massri     Answered On: Aug 06

ok, here's how the group is formed:
Dim uGrp as RefreshGroup
uGrp = New RefreshGroup(OpcSrv, 1, AddressOf CompleteHandler2)

thanx heaps for everyone's info, i guess it just isn't possible to
dynamically create  variables in vb.net.
I remember in ASP I used exec to create the line of code that would
create the variable, if i recall correctly (mind jumbled moving from
asp to vb.net and asp.net).

I have got around the need to dynamically  create the variables as now
all items (read from the database) are sent to ONE refresh group
who's interval is 1 second, so every one second, every item(or point)
that's wanted to be monitored is read every second and put into a
virtual table, now I got a timer to write this data to a db table
once every minute. My prob' is now in the Private Sub CompleteHandler2
I might just not see this correctly but I need to find  out who the
sender is..
the sub header is:
Private Sub CompleteHandler2(ByVal sender As Object, ByVal arg As
RefreshEventArguments)
if say i had the variable... item1name
then i could do:
uGrp.Read(OpcItem2Name, 1)

however the predefined intervals dont seem to be working..

 
Didn't find what you were looking for? Find more on Dynamic Variable Name creation Or get search suggestion and latest updates.




Tagged: