如果您在VB 2010中为HousePet
构建了一个结构,并且想要访问名为Coat
的结构元素,那么将该元素移动到变量中所需的代码行是什么{ {1}}?
Coat
答案 0 :(得分:2)
首先,你需要一个Struct类型的变量:
Private MyPet As HousePet
然后你可以像这样访问它:
Coat = MyPet._PetCoat
答案 1 :(得分:2)
'Public _Cost as Double
'A Typo?
'Did you mean Public _Coat as Double
Sub Main()
Dim HoundDog As HousePet
Dim Coat As String
Dim x As HousePet
Coat = x._Cost 'Or is it a typo? x._Coat?
End Sub