Hello once again,

i convert this class

public class Position
	{
		#region initialization
		// position stuff
		decimal latitude_fractional=0;
		string latitude_sexagesimal="";
		decimal latitude_decimal=0;
		decimal latitude_decimal_mem=0;
		CardinalDirection latitude_direction=CardinalDirection.North;

		decimal longitude_fractional=0;
		string longitude_sexagesimal="";
		decimal longitude_decimal=0;
		decimal longitude_decimal_mem=0;
		CardinalDirection longitude_direction=CardinalDirection.West;

		decimal altitudemax=0;
		decimal altitude=0;

		decimal geoidseparation=0;

		DateTime sattime=DateTime.MinValue;
		DateTime satdate=DateTime.MinValue;
		#endregion

		#region properties

    public Position clone() 
    {
      Position newPos = new Position();
      newPos.latitude_fractional=latitude_fractional;
      newPos.latitude_sexagesimal=latitude_sexagesimal;
      newPos.latitude_decimal=latitude_decimal;
      newPos.latitude_decimal_mem=latitude_decimal_mem;
      newPos.latitude_direction=latitude_direction;

      newPos.longitude_fractional=longitude_fractional;
      newPos.longitude_sexagesimal=longitude_sexagesimal;
      newPos.longitude_decimal=longitude_decimal;
      newPos.longitude_decimal_mem=longitude_decimal_mem;
      newPos.longitude_direction=longitude_direction;

      newPos.altitudemax=altitudemax;
      newPos.altitude=altitude;

      newPos.geoidseparation=geoidseparation;

      newPos.sattime=sattime;
      newPos.satdate=satdate;

      return newPos;
    }

		public string Latitude_Sexagesimal
		{
			get
			{
				return latitude_sexagesimal;
			}
		}

		public string Longitude_Sexagesimal
		{
			get
			{
				return longitude_sexagesimal;
			}

		}

		public CardinalDirection DirectionLongitude
		{
			get
			{
				return longitude_direction;
			}
			set
			{
				longitude_direction=value;
				if ((longitude_direction == CardinalDirection.South && longitude_decimal > 0) ||
				  (longitude_direction == CardinalDirection.North && longitude_decimal < 0))
				  longitude_decimal = -longitude_decimal;
			}
		}

		public CardinalDirection DirectionLatitude
		{
			get
			{
				return latitude_direction;
			}
			set
			{
				latitude_direction=value;
				if ((latitude_direction == CardinalDirection.West && latitude_decimal > 0) ||
				  (latitude_direction == CardinalDirection.East && latitude_decimal < 0))
				  latitude_decimal = -latitude_decimal;
			}
		}

		public decimal Latitude_Fractional
		{
			get
			{
				return latitude_fractional;
			}
			set
			{
				latitude_fractional=value;
				latitude_sexagesimal=Misc.DecimalToSexagesimal(value);
				// if direction latitude is SOUTH * -1
				decimal Sens=1;
				if (DirectionLatitude==CardinalDirection.South) Sens=-1;
				latitude_decimal=Misc.FractionalToDecimalDegrees(value) * Sens;
			}

		}

		public decimal Latitude_Decimal
		{
			get
			{
				return latitude_decimal;
			}
		}

		public decimal Latitude_Decimal_Mem
		{
			set
		{
			latitude_decimal_mem=value;
		}
			get
			{
				return latitude_decimal_mem;
			}
		}
		public decimal Longitude_Fractional
		{
			get
			{
				return longitude_fractional;
			}
			set
			{
				longitude_fractional=value;
				longitude_sexagesimal=Misc.DecimalToSexagesimal(value);
				// if direction longitude is WEST * -1
				decimal Sens=1;
				if (DirectionLatitude==CardinalDirection.West) Sens=-1;
				longitude_decimal=Misc.FractionalToDecimalDegrees(value) * Sens;
			}

		}

		public decimal Longitude_Decimal
		{
			get
			{
				return longitude_decimal;
			}
		}
		public decimal Longitude_Decimal_Mem
		{
			set
		{
			longitude_decimal_mem=value;
		}
			get
			{
				return longitude_decimal_mem;
			}
		}

		public decimal Altitude
		{
			get
			{
				return altitude;
			}
			set
			{
				altitude=value;
				if (altitude > altitudemax)
					altitudemax=altitude;
			}
		}
		public decimal AltitudeMax
		{
			get
			{
				return altitudemax;
			}
		}
		public decimal GeoidSeparation
		{
			get
			{
				return geoidseparation;
			}
			set
			{
				geoidseparation=value;
			}
		}
		public DateTime SatTime
		{
			get
			{
				return sattime;
			}
			set
			{
				sattime=value;
			}
		}

		public DateTime SatDate
		{
			get
			{
				return satdate;
			}
			set
			{
				satdate=value;
			}
		}

		#endregion
	}
}

to this

Public Class Position

    Public Enum CardinalDirection
        North = 0
        East = 1
        South = 2
        West = 4
        NorthWest = 5
        NorthEast = 6
        SouthWest = 7
        SouthEast = 8
        Stationary = 9
    End Enum


#Region "initialization"

    Private m_latitude_fractional As Decimal = 0
    Private m_latitude_sexagesimal As String = ""
    Private m_latitude_decimal As Decimal = 0
    Private m_latitude_decimal_mem As Decimal = 0
    Private latitude_direction As CardinalDirection = CardinalDirection.North

    Private m_longitude_fractional As Decimal = 0
    Private m_longitude_sexagesimal As String = ""
    Private m_longitude_decimal As Decimal = 0
    Private m_longitude_decimal_mem As Decimal = 0
    Private longitude_direction As CardinalDirection = CardinalDirection.West

    Private m_altitudemax As Decimal = 0
    Private m_altitude As Decimal = 0

    'Private m_geoidseparation As Decimal = 0

    Private m_sattime As DateTime = DateTime.MinValue
    Private m_satdate As DateTime = DateTime.MinValue
#End Region

#Region "properties"

    Public Function clone() As Position
        Dim newPos As New Position()
        newPos.Latitude_Fractional = m_latitude_fractional
        newPos.Latitude_Sexagesimal = m_latitude_sexagesimal
        newPos.Latitude_Decimal = m_latitude_decimal
        newPos.Latitude_Decimal_Mem = m_latitude_decimal_mem
        newPos.latitude_direction = latitude_direction

        newPos.Longitude_Fractional = m_longitude_fractional
        newPos.Longitude_Sexagesimal = m_longitude_sexagesimal
        newPos.Longitude_Decimal = m_longitude_decimal
        newPos.Longitude_Decimal_Mem = m_longitude_decimal_mem
        newPos.longitude_direction = longitude_direction

        newPos.AltitudeMax = m_altitudemax
        newPos.Altitude = m_altitude

        'newPos.geoidseparation = m_geoidseparation

        newPos.SatTime = m_sattime
        newPos.SatDate = m_satdate

        Return newPos
    End Function

    Public ReadOnly Property Latitude_Sexagesimal() As String
        Get
            Return m_latitude_sexagesimal
        End Get
    End Property

    Public ReadOnly Property Longitude_Sexagesimal() As String
        Get
            Return m_longitude_sexagesimal
        End Get
    End Property


    Public Property DirectionLongitude() As CardinalDirection
        Get
            Return longitude_direction
        End Get
        Set(ByVal value As CardinalDirection)
            longitude_direction = value
            If (longitude_direction = CardinalDirection.South AndAlso m_longitude_decimal > 0) OrElse (longitude_direction = CardinalDirection.North AndAlso m_longitude_decimal < 0) Then
                m_longitude_decimal = -m_longitude_decimal
            End If
        End Set
    End Property

    Public Property DirectionLatitude() As CardinalDirection
        Get
            Return latitude_direction
        End Get
        Set(ByVal value As CardinalDirection)
            latitude_direction = value
            If (latitude_direction = CardinalDirection.West AndAlso m_latitude_decimal > 0) OrElse (latitude_direction = CardinalDirection.East AndAlso m_latitude_decimal < 0) Then
                m_latitude_decimal = -m_latitude_decimal
            End If
        End Set
    End Property

    Public Property Latitude_Fractional() As Decimal
        Get
            Return m_latitude_fractional
        End Get
        Set(ByVal value As Decimal)
            m_latitude_fractional = value
            m_latitude_sexagesimal = Misc.DecimalToSexagesimal(value)
            ' if direction latitude is SOUTH * -1
            Dim Sens As Decimal = 1
            If DirectionLatitude = CardinalDirection.South Then
                Sens = -1
            End If
            m_latitude_decimal = Misc.FractionalToDecimalDegrees(value) * Sens
        End Set
    End Property


    Public ReadOnly Property Latitude_Decimal() As Decimal
        Get
            Return m_latitude_decimal
        End Get
    End Property

    Public Property Latitude_Decimal_Mem() As Decimal
        Get
            Return m_latitude_decimal_mem
        End Get
        Set(ByVal value As Decimal)
            m_latitude_decimal_mem = value
        End Set
    End Property
    Public Property Longitude_Fractional() As Decimal
        Get
            Return m_longitude_fractional
        End Get
        Set(ByVal value As Decimal)
            m_longitude_fractional = value
            m_longitude_sexagesimal = Misc.DecimalToSexagesimal(value)
            ' if direction longitude is WEST * -1
            Dim Sens As Decimal = 1
            If DirectionLatitude = CardinalDirection.West Then
                Sens = -1
            End If
            m_longitude_decimal = Misc.FractionalToDecimalDegrees(value) * Sens
        End Set
    End Property


    Public ReadOnly Property Longitude_Decimal() As Decimal
        Get
            Return m_longitude_decimal
        End Get
    End Property
    Public Property Longitude_Decimal_Mem() As Decimal
        Get
            Return m_longitude_decimal_mem
        End Get
        Set(ByVal value As Decimal)
            m_longitude_decimal_mem = value
        End Set
    End Property

    Public Property Altitude() As Decimal
        Get
            Return m_altitude
        End Get
        Set(ByVal value As Decimal)
            m_altitude = value
            If m_altitude > m_altitudemax Then
                m_altitudemax = m_altitude
            End If
        End Set
    End Property
    Public ReadOnly Property AltitudeMax() As Decimal
        Get
            Return m_altitudemax
        End Get
    End Property
    'Public Property GeoidSeparation() As Decimal
    '    Get
    '        Return m_geoidseparation
    '    End Get
    '    Set(ByVal value As Decimal)
    '        m_geoidseparation = value
    '    End Set
    'End Property
    Public Property SatTime() As DateTime
        Get
            Return m_sattime
        End Get
        Set(ByVal value As DateTime)
            m_sattime = value
        End Set
    End Property

    Public Property SatDate() As DateTime
        Get
            Return m_satdate
        End Get
        Set(ByVal value As DateTime)
            m_satdate = value
        End Set
    End Property

#End Region

End Class

but i get ERRORS my main problem is the readonly properties at the method clone
examples
Error 1 Property 'Latitude_Sexagesimal' is 'ReadOnly'.
and so on ....
whats the difference between those classes??
how can i make functional my class written in VB ?

One difference between C and VB is that C is case-sensitive, which means that variables can have the same name as properties as long as they differ in how you write them: int a_var is not the same as int A_var.

With that in mind, notice that the variables are set in the clone method in the C# class, not the properties.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.