刚刚尝试解决基于另一个变量名称从结构中获取特定内容的问题...
Sub Main()
Dim Testing As Test
ReDim Testing.A(15), Testing.B(13), Testing.C(10)
Dim Letter As String = Console.ReadLine() 'User Inputs A, B Or C
Testing.Letter(3) = "XXXXX" 'Selects the array of the letter the user has input from the Letter variable
End Sub
Structure Test
<VBFixedString(5)> <VBFixedArray(15)> Dim A() As Integer
<VBFixedString(5)> <VBFixedArray(13)> Dim B() As Integer
<VBFixedString(5)> <VBFixedArray(10)> Dim C() As Integer
End Structure
感谢您的关注和任何建议的解决方案,非常感谢。
答案 0 :(得分:0)
我不确定你在问什么,但也许你想要一个精选案例陈述?
Sub Main()
Dim Testing As Test
ReDim Testing.A(15), Testing.B(13), Testing.C(10)
Dim Letter As String = Console.ReadLine() 'User Inputs A, B Or C
Select Case Letter.ToUpper
Case "A" : Testing.A(3) = "XXXXX"
Case "B" : Testing.B(3) = "XXXXX"
Case "C" : Testing.C(3) = "XXXXX"
End Select
End Sub
您也可以使用反射...