Değişken öğe sayısını (kendileri başka bir sınıf nesnesi olan) tutacak bir sınıf oluşturmaya çalışıyorum. Sonra Sınıf 1 Sınıf 2 dizisi içeriyorVBA Sınıfı() nesnesi başka bir sınıfın mülkü olarak
' Class 2 contain each individual quote elements (OTC and MRC) Private pOTC As String Private pMRC As String Public Property Get OTC() As String OTC = pOTC End Property Public Property Let OTC(Value As String) pOTC = Value End Property Public Property Get MRC() As String MRC = pMRC End Property Public Property Let MRC(Value As String) pMRC = Value End Property
:
Yani, Sınıf 2 var
Private pCurr As String Private pQuote(20) As Class2 Public Property Get Curr() As String Curr = pCurr End Property Public Property Let Curr(Value As String) pCurr = Value End Property Public Property Set Quote(Index As Integer, cQuote As Class2) Set pQuote(Index) = cQuote End Property Public Property Get Quote(Index As Integer) As Class2 Quote = pQuote(Index) End Property
Ve ne ben yapmak istiyorum bir şey gibi:
Dim myQuotes As Class1 Set myQuotes = New Class1 myQuotes.Curr = "GBP" myQuotes.Quote(3).OTC = "1200"
İlk satır ayarı myQuotes.Curr sorun değil, ancak dizinin içinde bir değer ayarlamaya çalıştığımda sonraki satır hataları h Çalışma zamanı 91 değişken nesne veya bloğu değişkeni ben yanlış yapıyorum ne olduğu
Herhangi işaretçileri ayarlanmamış ve nasıl sınıf dizideki elemanların değerlerini ayarlayabilirsiniz?
Şimdiden teşekkürler!
Alex K., (meraktan) rica edebilir miyim? Neden bir alıntılar listesi kullanmak yerine onu böyle yapıyorsun? –