From: Clax on 26 May 2010 09:34 On May 26, 2:45 pm, Armin Zingler <az.nos...(a)freenet.de> wrote: > 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 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
From: Armin Zingler on 26 May 2010 09:47 Am 26.05.2010 15:34, 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 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
From: Cor Ligthert[MVP] on 26 May 2010 11:05 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 "Herfried K. Wagner [MVP]" <hirf-spam-me-here(a)gmx.at> wrote in message news:OxnklmM$KHA.980(a)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/>
From: Phill W. on 26 May 2010 12:13 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.
From: Patrice on 26 May 2010 13:16 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
First
|
Prev
|
Pages: 1 2 Prev: Umm.... How to pass a sub into a class...... Next: When is pinning required? |