Home All Groups Group Topic Archive Search About
Author
26 May 2010 9:57 AM
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????

Author
26 May 2010 10:30 AM
JR
On 26 mei, 11:57, Clax <claxc***@gmail.com> wrote:
> 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
Author
26 May 2010 11:17 AM
Clax
On May 26, 12:30 pm, JR <jan.sch***@gmail.com> wrote:
Show quoteHide quote
> On 26 mei, 11:57, Clax <claxc***@gmail.com> wrote:
>
> > 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

can you explain more about this
Author
26 May 2010 11:50 AM
Herfried K. Wagner [MVP]
Am 26.05.2010 11:57, schrieb Clax:
Show quoteHide quote
> 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.

--
  M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
  V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>
Author
26 May 2010 3:05 PM
Cor Ligthert[MVP]
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



Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:OxnklmM$KHA.980@TK2MSFTNGP04.phx.gbl...
> 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.
>
> --
>  M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>
Author
26 May 2010 12:45 PM
Armin Zingler
Am 26.05.2010 11:57, schrieb Clax:
Show quoteHide quote
> 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????

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


--
Armin
Author
26 May 2010 1:34 PM
Clax
On May 26, 2:45 pm, Armin Zingler <az.nos***@freenet.de> wrote:
Show quoteHide quote
> Am 26.05.2010 11:57, schrieb 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????
>
> http://en.wikipedia.org/wiki/Compiler
>
> --
> Armin

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

----   istruction
i+=1
end while

msgb***@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
Author
26 May 2010 1:47 PM
Armin Zingler
Am 26.05.2010 15:34, schrieb Clax:
Show quoteHide quote
>> http://en.wikipedia.org/wiki/Compiler
>>
>
> i explain more with example.
> --------------------
> num=1234
> varx=763
> i=23
> while
>
> ----   istruction
> i+=1
> end while
>
> msgb***@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


--
Armin
Author
26 May 2010 4:13 PM
Phill W.
On 26/05/2010 10:57, Clax wrote:

> 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.
Author
26 May 2010 5:16 PM
Patrice
Hi,

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

It really depends what you are trying to do. It could be as simple as
testing the name to get the corresponding value or as similar to adding
scripting capabilities like in Office applications etc...

> if i type in textbox "num" i want to dispay 1234
>
> if i type in textbox "varx" i want to display 763

Is the user allowed to enter num+varx  and you would like to output 1997 ?
Or is he allowed to enter just a name from a limited set of variables ?

--
Patrice