display var value

  • Thread starter Thread starter Clax
  • Start date Start date
C

Clax

Hi,
i want to display a value of a variabile, type into a textbox.

for example

num=1234
varx=763


if i type in textbox "num" i want to dispay 1234

if i type in textbox "varx" i want to display 763


who can i help????
 
Hi,
i want to display a value of a variabile, type into a textbox.

for example

num=1234
varx=763

if i type in textbox "num" i want to dispay 1234

if i type in textbox "varx" i want to display 763

who can i help????

walk trou the controls collection and if found use the text proprety

Jan
 
Am 26.05.2010 11:57, schrieb Clax:
i want to display a value of a variabile, type into a textbox.

for example

num=1234
varx=763


if i type in textbox "num" i want to dispay 1234

if i type in textbox "varx" i want to display 763


who can i help????

That's not possible because the names of local variables are not
available at runtime. You may, however, want to store the values in a
dictionary/collection object and use the variable name as key.
 
Am 26.05.2010 11:57, schrieb Clax:





http://en.wikipedia.org/wiki/Compiler

i explain more with example.
--------------------
num=1234
varx=763
i=23
while

---- istruction
i+=1
end while

msgbox(@textbox1.text)

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

if in textbox1.text="num" in msgbox write 1234
if in textbox1.text="varx" in msgbox write 763
if in textbox1.text="i" in msgbox write the actuale value of variabile
i


in visual dbase 5.5 il i write @inputtext for this
 
Am 26.05.2010 15:34, schrieb Clax:
i explain more with example.
--------------------
num=1234
varx=763
i=23
while

---- istruction
i+=1
end while

msgbox(@textbox1.text)

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

if in textbox1.text="num" in msgbox write 1234
if in textbox1.text="varx" in msgbox write 763
if in textbox1.text="i" in msgbox write the actuale value of variabile
i


in visual dbase 5.5 il i write @inputtext for this

Is visual dbase a compiler?

You're asking the user to enter a name known to the programmer only.
How can the user know? Variable names are placeholders for memory
addresses. When the native code is executed, there are no names anymore,
just addresses.

Maybe you are looking for this:
http://msdn.microsoft.com/en-us/library/xfhwa508(VS.90).aspx
 
Herfried,

I had the same idea like you, but my other thought was it is VBS.

However, this answer came in the General forum on this double post from
Claxian
------------------
Simply use ToString() method for getting string representation.
You had not specified the type of num,varz and i , if they are int then
following willl work;
if in textbox1.text="num" in msgbox write num.ToString();
if in textbox1.text="varx" in msgbox write varx.ToString();
if in textbox1.text="i" in msgbox write the actuale value of variabile
i.ToString();
-------------------------------------------------
I think that this answer meets the question the most (we were both thinking
about the type names, which is of course impossible with the overloaded
ToString from value types.

Cor
 
i want to display a value of a variable, type into a textbox.

Can't be done. Not directly anyway.
By the time your code runs, most variables names are long gone.

You could create a Hashtable or Dictionary(Of String,String) to hold
values that you want to access by name and interrogate that:

Dim dict as new Dictionary(Of String, String)
dict.Add( "num", "1234" )
dict.Add( "varx", "763" )

....then...

' Me.TextBox1.Text = "num"

Me.TextBox2.Text = dict( Me.TextBox1.Text )

HTH,
Phill W.
 
Back
Top