473,385 Members | 1,355 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,385 software developers and data experts.

Value of a "string"

Hi,
can anyone help me with the following:

Suppose I have a variable ll_temp containing pi and a variable test
containing "ll_temp". Then with what syntax do I get the value of pi
out of test ??

ll_temp = 3.1415926
test= "ll_temp"

Thanks in advance,

Jacco Struik
Jul 17 '05 #1
4 3240
"Jacco" <js*****@gmx.net> wrote in message
news:64**************************@posting.google.c om
Hi,
can anyone help me with the following:

Suppose I have a variable ll_temp containing pi and a variable test
containing "ll_temp". Then with what syntax do I get the value of pi
out of test ??

ll_temp = 3.1415926
test= "ll_temp"


VB doesn't have a direct way to do that. One option:

dim c as collection
set c=new collection
c.add il_temp,"il_temp"
msgbox c.item(test)

Jul 17 '05 #2
I see this type of question get asked a lot and I'm at a loss to understand
why. I've been programming since 1981 and have yet to run into a need to do
this type of indirection. After all, it could only be used successfully by
the programmer him/herself... I mean, you can't expect the user to know to
type in "ll_temp" into a TextBox in order for the program to go and get the
value of PI hiding underneath it. So, if it would only be used by the
programmer internally to his/her program, why not just use the variable
ll_temp directly? Or, if there is some kind of variability required (having
trouble imagining what), simply use a Select Case statement. And if needed
more than a couple of times, set up a function that runs the Select Case
instead so that you can pass in an argument indicating you want the value of
PI. Maybe make the function take a String argument so "ll_temp" could be
passed in even.<g>

Rick - MVP

"Bob Butler" <ti*******@nospam.com> wrote in message
news:h1Ibb.1819$gi2.485@fed1read01...
"Jacco" <js*****@gmx.net> wrote in message
news:64**************************@posting.google.c om
Hi,
can anyone help me with the following:

Suppose I have a variable ll_temp containing pi and a variable test
containing "ll_temp". Then with what syntax do I get the value of pi
out of test ??

ll_temp = 3.1415926
test= "ll_temp"


VB doesn't have a direct way to do that. One option:

dim c as collection
set c=new collection
c.add il_temp,"il_temp"
msgbox c.item(test)

Jul 17 '05 #3
VB doesn't do this kind of thing....also called macro substitution...

Best way is to follow Bob's example.

--
Stéphane Richard
"Ada World" Webmaster
http://www.adaworld.com
"Jacco" <js*****@gmx.net> wrote in message
news:64**************************@posting.google.c om...
Hi,
can anyone help me with the following:

Suppose I have a variable ll_temp containing pi and a variable test
containing "ll_temp". Then with what syntax do I get the value of pi
out of test ??

ll_temp = 3.1415926
test= "ll_temp"

Thanks in advance,

Jacco Struik

Jul 17 '05 #4
"Rick Rothstein" <ri************@NOSPAMcomcast.net> wrote in message
news:g6********************@comcast.com
I see this type of question get asked a lot and I'm at a loss to
understand why. I've been programming since 1981 and have yet to run
into a need to do this type of indirection. After all, it could only
be used successfully by the programmer him/herself... I mean, you
can't expect the user to know to type in "ll_temp" into a TextBox


I've dealt with a couple of cases where it would have come in handy; the
controlling data (e.g. 'il_temp') was coming from a database or some other
external source and the v alues to be used and/or actions to be taken depend
on one or more of the input fields... it's not something I've run into often
and I think many of the people asking it are doing so due more to limited
experience with alternate methods than a real need for what they are asking
for.

Jul 17 '05 #5

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

Similar topics

32
by: Indrid Colt | last post by:
Thank's for your help ! Indrid
0
by: Dana | last post by:
I am using the XMLTextWriter to build an XML string and pass it to the XMLDocument. When I get the data from SQL Server, some of the values passed to the XML are NULL in the database. When I try...
3
by: Andy Sutorius via DotNetMonster.com | last post by:
Hi, I have a Sorted List that has 9 key/value pairs. I am trying to take one of the key/value pairs and store the value of that key into a string variable. However, the value that actually gets...
9
by: rsine | last post by:
I have developed a program that sends a command through the serial port to our business system and then reads from the buffer looking for a number. Everything worked great on my WinXP system, but...
8
by: Peter Merwood | last post by:
I'm using some sample code from MSDN. The code includes the following statement: Dim content as = .Empty I'm not familiar with the use of the square brackets. Can someone please explain to...
9
by: Fei Liu | last post by:
In Accellerated C++, the author recommends that in a header file one should not declare using std::string, using std::vector etc instead one should directly specify the namespace specifier in...
4
by: Trapulo | last post by:
I've a webservice with a string parameter. I call this webservice passing a string that is 1129 chars length. On the webservice, the received string is 1146 length (I tested sizes with...
6
by: Don Lancaster | last post by:
I need to progrmatically do this inside a loop this.fh03.value = fixFloat (Harms, numPoints) ; with the numbers changing per an index. If I try curHvals = "03" ; // (derived from...
1
by: dhtmlkitchen | last post by:
Why does "foo" instanceof String return false? It just seems counterintuitive to me. I mean, sure, I can always check the constructor: var fooVar = "foo"; var isString =...
21
by: Sami | last post by:
string = "" or string = string.Empty? should is the proper way? Sami
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.