1

VB 2010 で a の構造を構築し、HousePetという構造要素にアクセスしたい場合Coat、要素を変数 に移動するために必要なコード行は何Coatですか?

Structure HousePet
   Public _Breed as String
   Public _PetCoat as String
   Public _Cost as Double
End Structure

   Sub Main()
        Dim HoundDog As HousePet
        Dim Coat as String
        **Insert Code Here**
   End Sub
4

2 に答える 2

2

まず、構造体の型の変数が必要です:

Private MyPet As HousePet

次に、次のようにアクセスできます。

Coat = MyPet._PetCoat
于 2013-04-29T20:37:11.123 に答える
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
于 2013-04-29T20:37:39.370 に答える