且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

真????

更新时间:2023-10-26 15:47:58

" Alex Pierson" < AR ****** @ charter.net> schrieb:
"Alex Pierson" <ar******@charter.net> schrieb:
有没有更简单的方法将字符串转换为
字符串代表的变量?
Is there no easier way to convert a string into the variable that the
string represents?




???


-

MS Herfried K. Wagner

MVP< URL:http://dotnet.mvps.org/ >

VB< URL:http://classicvb.org/petition/>



???

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>


抱歉这是一个回复到另一个线程,但是我的问题

就是这个。


我需要将字符串转换为由
$ b表示的值$ b变量与字符串同名。


EG。


Dim str as string =" var1"

dim var1 as integer = 5


我想在这种情况下将str转换为5.


谢谢。


Herfried K. Wagner [MVP]写道:
Sorry that was meant to be a reply to another thread, but my question
is this.

I need to convert a string into a value that is represented by a
variable that has the same name as the string.

EG.

Dim str as string = "var1"
dim var1 as integer = 5

I want to convert str in this case to 5.

Thanks.

Herfried K. Wagner [MVP] wrote:
" Alex Pierson" &LT; AR ****** @ charter.net&GT; schrieb:
"Alex Pierson" <ar******@charter.net> schrieb:
有没有更简单的方法将字符串转换为
字符串代表的变量?
Is there no easier way to convert a string into the variable that the
string represents?



???

-
MS Herfried K. Wagner
MVP< URL:http://dotnet.mvps.org/>
VB< URL:http:// classicvb .org / petition />



???

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>






听起来你可能需要HashTable。


Dim ht As New HashTable

ht.Add(" var1",5)

Dim var1 As Integer = ht(" var1")


" Alex Pierson" &LT; AR ****** @ charter.net&GT;在消息中写道

news:11 ********************** @ f14g2000cwb.googlegr oups.com ...
Sounds like you might need a HashTable.

Dim ht As New HashTable
ht.Add ("var1", 5)
Dim var1 As Integer = ht("var1")

"Alex Pierson" <ar******@charter.net> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
很抱歉这是对另一个帖子的回复,但我的问题是这个。

我需要将一个字符串转换为一个由
与字符串同名的变量。

EG。

Dim str as string =" var1"
dim var1 as integer = 5

我想在这种情况下将str转换为5.

谢谢。

Herfried K. Wagner [MVP]写道:
Sorry that was meant to be a reply to another thread, but my question
is this.

I need to convert a string into a value that is represented by a
variable that has the same name as the string.

EG.

Dim str as string = "var1"
dim var1 as integer = 5

I want to convert str in this case to 5.

Thanks.

Herfried K. Wagner [MVP] wrote:
" Alex Pierson" &LT; AR ****** @ charter.net&GT; schrieb:
"Alex Pierson" <ar******@charter.net> schrieb:
>有没有更简单的方法将字符串转换为
>的变量字符串代表?
> Is there no easier way to convert a string into the variable that the
> string represents?



???

MS Herfried K. Wagner
MVP< URL:http:// dotnet.mvps.org/>
VB< URL:http://classicvb.org/petition/>



???

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>