2016-04-07 12 views
-1

私には問題があり、解決方法はわかりません。あるクラスから別のクラスにデータを追加する方法

私は2つの異なるクラスを持っており、私は別のクラスの第1クラスにあるデータを取得する必要があります。以下のような

私の最初のクラスを見て:

Public Class TempEK1OsposTeorija 

Private _sif_ovl_osobe As Integer 
Private _datum_teorija As Date 
Private _datum_praksa As Date 
Private _prezime_ime As String 
Private _strucna_sprema As String 

今私は公共の場でデータを取得する必要があります:私はしたい

ウィッヒで
Public Class ZnrEk1Ospos 


Private _sif_tvrtka As Integer 
Private _sif_radnika As Integer 
Private _red_broj As Integer 
Private _sif_ovl_osobe As Integer 
Private _datum_teorija As Date 
Private _datum_praksa As Date 
Private _prezime_ime As String 
Private _strucna_sprema As String 
Private _funkcija As String 
Private _status_obrasca As Integer 
Private _glavni_instruktor As Integer 
Private _instruktor_prezime As String 
Private _instruktor_sprema As String 
Private _instruktor_funkcija As String 
Private _evidencijski_broj As String 
Private _potvrda As String 

Public Sub New() 
    'Do nothing as all private variables has been initiated 
End Sub 

Public Sub New(ByVal DataRow As DataRow) 
    _sif_tvrtka = CInt(DataRow.Item("sif_tvrtka")) 
    _sif_radnika = CInt(DataRow.Item("sif_radnika")) 
    _red_broj = CInt(DataRow.Item("red_broj")) 
    _sif_ovl_osobe = CInt(DataRow.Item("sif_ovl_osobe")) 
    _datum_teorija = IIf(IsDBNull(DataRow.Item("datum_teorija")), Nothing, DataRow.Item("datum_teorija")) 
    _datum_praksa = IIf(IsDBNull(DataRow.Item("datum_praksa")), Nothing, DataRow.Item("datum_praksa")) 
    _prezime_ime = IIf(IsDBNull(DataRow.Item("prezime_ime")), "", Trim(DataRow.Item("prezime_ime"))) 
    _strucna_sprema = IIf(IsDBNull(DataRow.Item("strucna_sprema")), "", Trim(DataRow.Item("strucna_sprema"))) 
    _funkcija = IIf(IsDBNull(DataRow.Item("funkcija")), "", Trim(DataRow.Item("funkcija"))) 
    _status_obrasca = CInt(DataRow.Item("status_obrasca")) 
    _glavni_instruktor = CInt(DataRow.Item("glavni_instruktor")) 
    _instruktor_prezime = IIf(IsDBNull(DataRow.Item("instruktor_prezime")), "", Trim(DataRow.Item("instruktor_prezime"))) 
    _instruktor_sprema = IIf(IsDBNull(DataRow.Item("instruktor_sprema")), "", Trim(DataRow.Item("instruktor_sprema"))) 
    _instruktor_funkcija = IIf(IsDBNull(DataRow.Item("instruktor_funkcija")), "", Trim(DataRow.Item("instruktor_funkcija"))) 
    _evidencijski_broj = IIf(IsDBNull(DataRow.Item("evidencijski_broj")), "", Trim(DataRow.Item("evidencijski_broj"))) 
    _potvrda = IIf(IsDBNull(DataRow.Item("potvrda")), "", Trim(DataRow.Item("potvrda").ToString)) 
End Sub 


Public Property sif_tvrtka() As Integer 
    Get 
     Return _sif_tvrtka 
    End Get 
    Set(ByVal value As Integer) 
     _sif_tvrtka = value 
    End Set 
End Property 
Public Property sif_radnika() As Integer 
    Get 
     Return _sif_radnika 
    End Get 
    Set(ByVal value As Integer) 
     _sif_radnika = value 
    End Set 
End Property 
Public Property red_broj() As Integer 
    Get 
     Return _red_broj 
    End Get 
    Set(ByVal value As Integer) 
     _red_broj = value 
    End Set 
End Property 
Public Property sif_ovl_osobe() As Integer 
    Get 
     Return _sif_ovl_osobe 
    End Get 
    Set(ByVal value As Integer) 
     _sif_ovl_osobe = value 
    End Set 
End Property 
Public Property datum_teorija() As Date 
    Get 
     Return _datum_teorija 
    End Get 
    Set(ByVal value As Date) 
     _datum_teorija = value 
    End Set 
End Property 
Public Property datum_praksa() As Date 
    Get 
     Return _datum_praksa 
    End Get 
    Set(ByVal value As Date) 
     _datum_praksa = value 
    End Set 
End Property 
Public Property prezime_ime() As String 
    Get 
     Return _prezime_ime 
    End Get 
    Set(ByVal value As String) 
     _prezime_ime = value 
    End Set 
End Property 
Public Property strucna_sprema() As String 
    Get 
     Return _strucna_sprema 
    End Get 
    Set(ByVal value As String) 
     _strucna_sprema = value 
    End Set 
End Property 
Public Property funkcija() As String 
    Get 
     Return _funkcija 
    End Get 
    Set(ByVal value As String) 
     _funkcija = value 
    End Set 
End Property 
Public Property status_obrasca() As Integer 
    Get 
     Return _status_obrasca 
    End Get 
    Set(ByVal value As Integer) 
     _status_obrasca = value 
    End Set 
End Property 
Public Property glavni_instruktor() As Integer 
    Get 
     Return _glavni_instruktor 
    End Get 
    Set(ByVal value As Integer) 
     _glavni_instruktor = value 
    End Set 
End Property 
Public Property instruktor_prezime() As String 
    Get 
     Return _instruktor_prezime 
    End Get 
    Set(ByVal value As String) 
     _instruktor_prezime = value 
    End Set 
End Property 
Public Property instruktor_sprema() As String 
    Get 
     Return _instruktor_sprema 
    End Get 
    Set(ByVal value As String) 
     _instruktor_sprema = value 
    End Set 
End Property 
Public Property instruktor_funkcija() As String 
    Get 
     Return _instruktor_funkcija 
    End Get 
    Set(ByVal value As String) 
     _instruktor_funkcija = value 
    End Set 
End Property 
Public Property evidencijski_broj() As String 
    Get 
     Return _evidencijski_broj 
    End Get 
    Set(ByVal value As String) 
     _evidencijski_broj = value 
    End Set 
End Property 

Public Property potvrda() As String 
    Get 
     Return _potvrda 
    End Get 
    Set(ByVal value As String) 
     _potvrda = value 
    End Set 
End Property 

そして、私の第二のクラスは以下のように私の最初のクラスを見てからデータを取りに行きますクラスTempEK1OsposTeorijaフォームクラスPublicクラスZnrEk1Ospos。

誰かがそれを行う方法を知っていますか?

+0

赤穂tiのJE odgovor pomogao私prihvati GAを作成する必要があります。) – Dejan

答えて

1

あなたは、そのクラスの新しいインスタンス

Public Class TempEK1OsposTeorija 

    Private _sif_ovl_osobe As Integer 
    Private _datum_teorija As Date 
    Private _datum_praksa As Date 
    Private _prezime_ime As String 
    Private _strucna_sprema As String 

    Public sub PozoviKlasuIvratiPodatke() 

' To use the word using you must implement the IDisposable Interface into first class 

     Using cl as new ZnrEk1Ospos 

     'get data from first class 

     _sif_ovl_osobe = cl._sif_ovl_osobe 
     _datum_teorija = cl._datum_teorija 
     _datum_praksa = cl._datum_praksa 
     _prezime_ime = cl._prezime_ime 
     _strucna_sprema = cl._strucna_sprema 

     End using 

    End sub 
End class