Predmet:Re: Skola Vb-a za napredne
Evo jos jedan prostiji primjer.
Napravite novi KLas modul i dajte mu ime ART.
PARAMETRI:
Attribute VB_Name = "ART"
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
U njega smjestite sledeci kod:
PreuzmiIzvorni kôd (Visual Basic):Option Compare Database
Option Explicit
Private Art_Ime As String
Private Art_ID As String
Private Sub Class_Initialize()
Art_Ime = "Kisela voda"
Art_ID = "0045"
End Sub
Private Sub Class_Terminate()
Art_Ime = ""
Art_ID = ""
End Sub
Public Property Get Ime_Art() As String
Ime_Art = Art_Ime
End Property
Public Property Let Ime_Art(ART As String)
Art_Ime = ART
End Property
Public Property Get ID_Art() As String
ID_Art = Art_ID
End Property
Public Property Let ID_Art(Id As String)
Art_ID = Id
End Property
Sada otvorite neki obicni modul i u njega kopirajte ovaj kod koji sluzi za probu.
PreuzmiIzvorni kôd (Visual Basic):Option Compare Database
Option Explicit
Function Probaart()
Dim A As ART
Set A = New ART
MsgBox A.ID_Art & "-" & A.Ime_Art
A.ID_Art = "0001"
A.Ime_Art = "okolada"
MsgBox A.ID_Art & "-" & A.Ime_Art
End Function
Podrska samo putem foruma, jer samo tako i ostali imaju koristi od toga.