Programming

I have a need to read the fields of a structure in a for loop for eg. the structure looks like:
str.a1, str.a2, str.a3 where a1, a2, a3 are of type string
How do I do it?

You should be able to do this with reflection. Below is a quick demo of how
to pull fields from a structure.

Module Module1

Sub Main()

Dim StructInstance As MyStruct
StructInstance.Prop1 = "Foo"
StructInstance.Prop2 = "Bar"

Dim propInfo As Reflection.FieldInfo() = Type.GetType("ConsoleApplication1.MyStruct").GetFields
For Each item As Reflection.FieldInfo In propInfo
Console.WriteLine(item.GetValue(StructInstance))
Next
Console.ReadKey()
End Sub

End Module

Public Structure MyStruct
Public Prop1 As String
Public Prop2 As String
End Structure