Question Structure Assignment

IanB

New member
Joined
Jun 13, 2012
Messages
2
Location
Canada
Programming Experience
10+
So far I can't figure out the format for this operation, can anyone help?

I have an array of a structure and I need to assign an element of this array to a variable of the same type. In vb6 I'd use something like the following pseudo-code:
VB.NET:
Type Name
Dim first as string
Dim second as string
End type

dim names() as Name
Dim aname as Name
...
...
' assume redim, assignment etc is done
[B]aname = names(10)
[/B]
Assuming this is now vb.net and that's a structure etc - how do I do that last line??

Thanks
Ian
 
What you have shown is exactly what you would do in VB.NET. If you have tried that and it didn't work as you expected then it's because you did something else wrong. Tell us what actually happened and then we can likely tell you what you did wrong.
 
What you have shown is exactly what you would do in VB.NET. If you have tried that and it didn't work as you expected then it's because you did something else wrong. Tell us what actually happened and then we can likely tell you what you did wrong.

I'm sorry, I should have been much more specific.

This is a vb6 program which I ran thru the vb.net upgrader in VS2008. What I'm getting is an upgrade warning which I don't understand:
Couldn't resolve default property of object aDistrict
where aDistrict is the equivalent of "aname" in my original post, i.e. it's a variable of the structure.

I don't know if it's because I need a property in my structure, and if so, I don't know the format of a structure property to return the entire structure.

Thanks

 
Back
Top