Hello im trying to create a class in vb and when and try to instance the class the class is without any value
Private lat As Double
Private lon As Double
Public Property Get Longitud() As Double
Longitud = lon
End Property
Public Property Get Latitud() As Double
Latitud = lat
End Property
Public Property Let Longitud(ByVal longi As Double)
Longitud = lon
End Property
Public Property Let Latitud(ByVal lati As Double)
Latitud = lat
End Property
And when im trying to instance
Dim cord As Coordenadas
Set cord = New Coordenadas
cord.Latitud = 40.30416667
cord.Longitud = 0.22583333
I cant see any change in the cord
Your Let property is not allocating correctly the value you passed as argument.
It should be as follows:
Letshould assign the value to your private variable (Lon) andGetshould retrieve the value stored inside that variable.Just as an addition, it will help you a lot if you give your private properties a special suffix. For example pLon and pLat. This way is easier for you to identify the variables from the arguments and properties.