我为每个外部参数变量分配了值,但我无法通过循环调用赋值。
我现在使用的代码可供参考。
提前致谢...
Module Module1
Public Int_Parameters() As String = {"Int_D1", _
"Int_D2", _
"Int_D3", _
"Int_D4"}
Public Ext_Parameters() As Integer= {"Ext_D1", _
"Ext_D2", _
"Ext_D3", _
"Ext_D4"}
Sub Assigning_Values()
Ext_D1 = 25
Ext_D2 = Ext_D1 + 25
Ext_D3 = Ext_D2 + 25
Ext_D4 = Ext_D3 + 25
End Sub
Sub Loop()
For Each Int_Parameter As String in Int_Parameters
For Each Ext_Parameter As String in Ext_Parameters
Int_Parameter = Ext_Parameter 'Ext_Parameter Value is 0 but i need the Assigned Values instead of 0
Next
Next
End Sub
End Module
答案 0 :(得分:0)
Module Module1
Public Int_Parameters() As String = {"Int_D1", _
"Int_D2", _
"Int_D3", _
"Int_D4"}
Public Ext_D1, Ext_D2, Ext_D3, Ext_D4 As Integer
Public List1 As New ArrayList
Sub Assigning_Values()
Ext_D1 = 25
Ext_D2 = Ext_D1 + 25
Ext_D3 = Ext_D2 + 25
Ext_D4 = Ext_D3 + 25
Dim Ext_Parameters() As Integer= {"Ext_D1", _
"Ext_D2", _
"Ext_D3", _
"Ext_D4"}
For Each Ext_Parameter As Integer in Ext_Parameters
List1.Add(Ext_Parameter)
Next
End Sub
Sub Loop()
For Each Int_Parameter As String in Int_Parameters
For Each Ext_Parameter As Integer in Ext_Parameters
Int_Parameter = Ext_Parameter
Next
Next
End Sub
End Module