1
的目標我有兩個類:結構特性 - 表達式的值,因此不能作爲賦值
Public Class SubiektGT
Dim daneKlienta As SklepPobieranieDanych = New SklepPobieranieDanych(Me)
Public Sub PrzefiltrujDaneKontrahenta()
If daneKlienta.DaneKontrahenta.adres_fv = "" Then
daneKlienta.DaneKontrahenta.adres_fv = daneKlienta.DaneKontrahenta.adres_wys 'ERROR
End If
End Sub
End Class
Public Class SklepPobieranieDanych
Public Structure Kontrahent
Public adres_wys As String
Public adres_fv As String
End Structure
Private _daneKontrahenta As Kontrahent
Public Property DaneKontrahenta() As Kontrahent
Get
Return _daneKontrahenta
End Get
Set(value As Kontrahent)
_daneKontrahenta = value
End Set
End Property
Public Sub PobierzTowaryKontrahenta()
_daneKontrahenta.adres_fv = ""
_daneKontrahenda.adres_wys = "a"
End Sub
End Class
當我嘗試從不同的類值分配給daneKlienta.DateKontrahenta.adres_fv
我收到以下錯誤:表達式是一個值,因此不能成爲任務的目標。
那麼如何從該類中指定一個值呢?這樣做對我來說非常重要,並請有人向我解釋爲什麼會發生。謝謝!
哦,現在我明白了班級和結構之間的區別,謝謝!所以爲了解決我的問題,我將把結構變成一個類:) – XardasLord 2014-09-23 11:54:00