Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

Retrieve data using objects VB.NET (WPFAplication)

$
0
0

Currently, I make aWPF applicationin VB.NETlanguage.Myapplication iscomposed of severalWindowshostingdifferent controls.Now I have tocreate multiple objectsthat allow meto have access todatamanipulated bycontrols.The objects that need createshould be simple,ie, the declaration ofattributes,properties.I must notuse serializationor any other methodto save the data.The only thing thatI need to dois to createobjects thatallow me to haveaccess to data andthenaddress them.

My question is:When creatingobjects, how do Iknow if I shouldjust use"Properties"and not "methods" because itdoes not needto make acalculation for themoment.Here is an exampleof an objectthat I createdto retrieve data:

Public Class DataResultats

    Private _NombAudit As String
    Private _DateAudit As String
    Private _NuOccupants As String
    Private _Eclairage As String
    Private _NuMachines As String
    Private _HOccupants As String
    Private _AgeBatiment As String
    Private _Surface As String
    Private _Volume As String


#Region "propiété"

    Public Property NombreAudit() As String
        Get
            Return _NombAudit
        End Get

        Set(ByVal value As String)
            _NombAudit = value
        End Set
    End Property


    Public Property FechaAudit() As String
        Get
            Return _DateAudit
        End Get

        Set(ByVal value As String)
            _DateAudit = value
        End Set
    End Property


    Public Property NumeroOccupants() As String
        Get
            Return _NuOccupants
        End Get

        Set(ByVal value As String)
            _NuOccupants = value
        End Set
    End Property

    Public Property LumierEclairage() As String
        Get
            Return _Eclairage
        End Get

        Set(ByVal value As String)
            _Eclairage = value
        End Set
    End Property

    Public Property NumeroMachines() As String
        Get
            Return _NuMachines
        End Get

        Set(ByVal value As String)
            _NuMachines = value
        End Set
    End Property

    Public Property HeureOccupant() As String
        Get
            Return _HOccupants
        End Get

        Set(ByVal value As String)
            _HOccupants = value
        End Set
    End Property

    Public Property AncianBatiment() As String
        Get
            Return _AgeBatiment
        End Get

        Set(ByVal value As String)
            _AgeBatiment = value
        End Set
    End Property

    Public Property SuperficieBatiment() As String
        Get
            Return _Surface
        End Get

        Set(ByVal value As String)
            _Surface = value
        End Set
    End Property

    Public Property VolumeBatiment() As String
        Get
            Return _Volume
        End Get

        Set(ByVal value As String)
            _Volume = value
        End Set
    End Property
#End Region



#Region "Méthodes"

    Public Sub New()

    End Sub



    Public Sub AllDonneesInstallation(ByVal nombreAudit As Date, ByVal fechaAudit As String, ByVal numeroOccupants As Date, ByVal lumierEclairage As String, ByVal numeroMachines As Date, ByVal heureOccupant As String, ByVal ancianBatiment As Date, ByVal superficieBatiment As String, ByVal volume As String)         Me.NombreAudit = nombreAudit
        Me.FechaAudit = fechaAudit
        Me.NumeroOccupants = numeroOccupants
        Me.LumierEclairage = lumierEclairage
        Me.NumeroMachines = numeroMachines
        Me.HeureOccupant = heureOccupant
        Me.AncianBatiment = ancianBatiment
        Me.SuperficieBatiment = superficieBatiment
        Me.VolumeBatiment = volume
    End Sub
#End Region

End Class

In the last class, you can see that i made an Methode but That wasa suggestionof mytutor. HonestlyI do not understandthat it servesthat method.

Here, i show you another object, but This objecthas nomethods:

Public Class DataAcquisition
    Public Sub New()
        ' Rien à faire.
    End Sub
#Region "Déclaration"
    Public DateData As Date
    Public MesureCapteur As String

#End Region

#Region "Propiétés"

    Public Property Dates() As Date
        Get
            Return DateData
        End Get
        Set(ByVal value As Date)
            DateData = value
            'OnPropertyChanged("Modem")
        End Set
    End Property
    Public Property CapteurMesure() As String
        Get
            Return MesureCapteur
        End Get
        Set(ByVal value As String)
            MesureCapteur = value
            '  OnPropertyChanged("Satellite")
        End Set
    End Property
#End Region


End Class

SoI wonderwhenI usemethods orproperties?
Perhapsit is enoughpropertiesto recover data?

Thanks

 


 

                                             

Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>