2013-03-16 23 views
0

我很抱歉,如果问题有点乏味,但我想要做的是从文本文件如“R1”,“R2”,“R3”访问列表中的东西。是否有可能将该名称中的整数作为一个单独的变量?Visual Basic:如何在变量中使用整数?

所以,如果我有...

Dim R0 As String = "Hello" 
Dim R1 As String = "Goodbye" 

Dim RCount As Integer = 0 

MsgBox(R & RCount) 'Returns Hello 

回答

2

不是没有创建和评估的Expression Tree,但你可以使用一个数组和一个索引到数组。

Dim R(6) as String 

R(0) = "Hello" 
R(1) = "Goodbye" 

Dim RCount as Integer = 0 

MsgBox(R(RCount)) 
相关问题