0% found this document useful (0 votes)
276 views5 pages

Appendix L Program Source Code

This document contains code for several dialog boxes and forms in Visual Basic, including: 1. A time and date box that allows updating the system time and date by parsing a date string. 2. An image browser box that allows selecting an image file from a USB drive to use as a logo. 3. An input box that handles keyboard input and includes a numeric keypad overlay. It is used for file archiving, removal, and accessing. 4. The boxes make use of timers, buttons, labels and other controls to handle their various functions like time/date setting, file operations, and keyboard input.

Uploaded by

Ojibwe Unanimes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
276 views5 pages

Appendix L Program Source Code

This document contains code for several dialog boxes and forms in Visual Basic, including: 1. A time and date box that allows updating the system time and date by parsing a date string. 2. An image browser box that allows selecting an image file from a USB drive to use as a logo. 3. An input box that handles keyboard input and includes a numeric keypad overlay. It is used for file archiving, removal, and accessing. 4. The boxes make use of timers, buttons, labels and other controls to handle their various functions like time/date setting, file operations, and keyboard input.

Uploaded by

Ojibwe Unanimes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

SOURCE CODES

DIALOG BOXES FORMS

Time and Date Box


ImportsSystem.Runtime.InteropServices
PublicClassCoreTIMEDATE
<StructLayout(LayoutKind.Sequential)>PrivateStructureSYSTEMTIME
<MarshalAs(UnmanagedType.U2)>PublicYearAsShort
<MarshalAs(UnmanagedType.U2)>PublicMonthAsShort
<MarshalAs(UnmanagedType.U2)>PublicDayOfWeekAsShort
<MarshalAs(UnmanagedType.U2)>PublicDayAsShort
<MarshalAs(UnmanagedType.U2)>PublicHourAsShort
<MarshalAs(UnmanagedType.U2)>PublicMinuteAsShort
<MarshalAs(UnmanagedType.U2)>PublicSecondAsShort
<MarshalAs(UnmanagedType.U2)>PublicMillisecondsAsShort
EndStructure

PrivateDeclareFunctionSetLocalTimeLib"kernel32.dll"(ByReflpSystemTime
AsSYSTEMTIME)AsBoolean
PublicSharedFunctionUpdateSystemTime(ByValDateObjectAsDate)AsBoolean
DimnewDTAsSYSTEMTIME
WithnewDT
.Day=DateObject.Day
.DayOfWeek=DateObject.DayOfWeek
.Hour=DateObject.Hour
.Milliseconds=DateObject.Millisecond
.Minute=DateObject.Minute
.Second=DateObject.Second
.Month=DateObject.Month
.Year=DateObject.Year
EndWith
DimblnResultAsBoolean=SetLocalTime(newDT)
ReturnblnResult
EndFunction

PrivateSubdatetime_Tick(senderAsSystem.Object,eAsSystem.EventArgs)
Handlesdatetime.Tick
lbldate.Text=FormatDateTime(Date.Now,DateFormat.LongDate)
lbltime.Text=Format(TimeOfDay,"t")
EndSub

PrivateSubButton2_Click(senderAsSystem.Object,eAsSystem.EventArgs)
HandlesButton2.Click,Button7.Click,Button12.Click,Button8.Click,
Button11.Click,Button9.Click,Button10.Click,Button6.Click,Button5.Click
Ifsender.Equals(Button6)Then
IfUpdateSystemTime(Date.Parse(Label26.Text&""&Label27.Text&","
&Label28.Text))Then
addAudit("ADMIN","1000",Format(Now,"Generaldate"),"MACHINE
SETTING","SYSTEMDATECHANGED")
INFO("SUCCEEDED!")
EndIf
EndIf
datesetting(sender,Button2,Panel4,Label26,Button7,Button12,Label27,
Button8,Button11,Label28,Button9,Button10,Button6,Button5)
EndSub

Microcontroller-Based Filing Cabinet with Biometric Technology


for STI College of Meycauayan

L-1

PrivateSubButton17_Click(senderAsSystem.Object,eAsSystem.EventArgs)
HandlesButton17.Click,Button18.Click,Button15.Click,Button4.Click,
Button14.Click,Button3.Click,Button13.Click,Button1.Click,Button16.Click
Ifsender.Equals(Button17)Then
IfLabel2.Text="PM"Then
Label4.Text=(CInt(Label4.Text)+12)
EndIf
IfUpdateSystemTime(Date.Parse(Label4.Text&":"&Label3.Text&
":00"))Then
addAudit("ADMIN","1000",Format(Now,"Generaldate"),"MACHINE
SETTING","SYSTEMTIMECHANGED")
INFO("SUCCEEDED!")
EndIf
EndIf
timesetting(sender,Button18,Panel5,Label4,Button15,Button4,Label3,
Button14,Button3,Label2,Button13,Button1,Button17,Button16)
EndSub

PrivateSubDONE_Click(senderAsSystem.Object,eAsSystem.EventArgs)Handles
DONE.Click
Me.DialogResult=Windows.Forms.DialogResult.OK
EndSub
EndClass

USB Image Browser Box


PublicClassCoreIMAGEBOX
PrivateSubFileListBox1_SelectedIndexChanged(senderAsSystem.Object,eAs
System.EventArgs)HandlesFileListBox1.SelectedIndexChanged
IfIO.Directory.Exists("C:\CORE\logo\")=FalseThen
IO.Directory.CreateDirectory("C:\CORE\logo\")
Else
IO.Directory.Delete("C:\CORE\logo\",True)
IO.Directory.CreateDirectory("C:\CORE\logo\")
EndIf
Try
Ifexdrive()Then
Try
IO.File.Copy(exdrivepath()&FileListBox1.SelectedItem,
"C:\CORE\logo\"&FileListBox1.SelectedItem)
CatchexAsException
EndTry
PictureBox1.Image=Image.FromFile(exdrivepath()&
FileListBox1.SelectedItem)
Label1.Text=FileListBox1.SelectedItem
Else
Me.DialogResult=Windows.Forms.DialogResult.No
EndIf
CatchexAsException
Me.DialogResult=Windows.Forms.DialogResult.No
EndTry
EndSub

PrivateSubButton1_Click(senderAsSystem.Object,eAsSystem.EventArgs)
HandlesButton1.Click
PictureBox1.Image=My.Resources.mbfclogo
Label1.Text="DEFAULTLOGO"
IfIO.Directory.Exists("C:\CORE\logo\")Then
IO.Directory.Delete("C:\CORE\logo\",True)

Microcontroller-Based Filing Cabinet with Biometric Technology


for STI College of Meycauayan

L-2

EndIf
Me.DialogResult=Windows.Forms.DialogResult.Yes
EndSub
EndClass

Input Box, File Removal Box, File Archiving Box, File Accessing Box
PublicClassCoreINPUTBOX
PrivateSubKBhide_Click(senderAsSystem.Object,eAsSystem.EventArgs)
HandlesKBPosChange.Click,KBrl.Click,KBcenter.Click,KBback.Click,A.Click,
B.Click,C.Click,D.Click,E.Click,F.Click,G.Click,H.Click,I.Click,
J.Click,K.Click,L.Click,M.Click,N.Click,O.Click,P.Click,Q.Click,
R.Click,S.Click,T.Click,U.Click,V.Click,W.Click,X.Click,Y.Click,
Z.Click,KBspace.Click,zero.Click,one.Click,two.Click,three.Click,
four.Click,five.Click,six.Click,seven.Click,eight.Click,nine.Click
KEYP(sender,Num,Alpha,KBspace,KBPosChange,KBcontrol,KBani)
EndSub

PrivateSubKBani_Tick(senderAsSystem.Object,eAsSystem.EventArgs)Handles
KBani.Tick
IfMe.Visible=TrueThen
If(KB.Height<134)Then
KB.Height=KB.Height+6
ElseIf(KB.Height>134)Then
KB.Height=134
EndIf
EndIf
EndSub

PrivateSubSecTimer_Tick(senderAsSystem.Object,eAsSystem.EventArgs)
HandlesSecTimer.Tick
DimnumAsInteger=Mid(lb3.Text,1,2)
Ifnum1<>0Then
lb3.Text=num1&"sec"
Else
cbt2.PerformClick()
EndIf
EndSub

PrivateSubtb4_GotFocus(senderAsObject,eAsSystem.EventArgs)Handles
tb4.GotFocus
lb4.Hide()
KBkey=sender
KBshowspace(KBspace,True)
KBshownum(Num,True)
KBshowalpha(Alpha,True)
EndSub

PrivateSublb4_Click(senderAsSystem.Object,eAsSystem.EventArgs)Handles
lb4.Click
lb4.Hide()
tb4.Focus()
EndSub

PrivateSublb4_LostFocus(senderAsObject,eAsSystem.EventArgs)Handles
lb4.LostFocus
Ifsender.text=""Then
lb4.Show()
EndIf

Microcontroller-Based Filing Cabinet with Biometric Technology


for STI College of Meycauayan

L-3

EndSub

PrivateSubCoreINPUTBOX_SizeChanged(senderAsObject,eAsSystem.EventArgs)
HandlesMe.SizeChanged
Me.WindowState=FormWindowState.Normal
EndSub

PrivateSubcbt2_Click(senderAsSystem.Object,eAsSystem.EventArgs)Handles
cbt2.Click
DialogResult=Windows.Forms.DialogResult.Cancel
EndSub

PrivateSubButton1_Click(senderAsSystem.Object,eAsSystem.EventArgs)
HandlesButton1.Click
IfButton1.Text="OK"Then
Iftb4.Text<>""Then
Trim(tb4.Text)
IfisFilenameUnique(tb4.Text,CoreLOGIN.USERCODE.Text)Then
Button1.Text="FINISHARCHIVING"
PictureBox2.Show()
PictureBox1.Hide()
tb4.Hide()
Label2.Hide()
Label3.Show()
Label5.Show()
Label6.Show()
Else
INFO(lb4.Text&"ISNOTAVAILABLE!")
tb4.Clear()
EndIf
Else
INFO("INSERT"&lb4.Text&"FIRST!")
EndIf
ElseIfButton1.Text="FINISHARCHIVING"Then
addFile(CoreLOGIN.USERCODE.Text,tb4.Text,slot.Text,
shelfletter.Text)
gettotalFSU(CoreLOGIN.USERCODE.Text)
DialogResult=Windows.Forms.DialogResult.Yes
INFO("ARCHIVINGSUCCESS!")
ElseIfButton1.Text="FINISHREMOVAL"Then
removeFile(slot.Text,shelfletter.Text)
gettotalFSU(CoreLOGIN.USERCODE.Text)
DialogResult=Windows.Forms.DialogResult.Yes
INFO("REMOVALSUCCESS!")
ElseIfButton1.Text="FINISHACCESSING"Then
DialogResult=Windows.Forms.DialogResult.Yes
INFO("ACCESSINGSUCCESS!")
ElseIfButton1.Text="FINISHACCESSING"Then
DialogResult=Windows.Forms.DialogResult.Yes
INFO("SEARCHINGSUCCESS!")
EndIf
EndSub

PrivateSubtb4_TextChanged(senderAsSystem.Object,eAsSystem.EventArgs)
Handlestb4.TextChanged
Iftb4.TextLength=0Then
lb4.Show()
EndIf

Microcontroller-Based Filing Cabinet with Biometric Technology


for STI College of Meycauayan

L-4

EndSub
EndClass

Microcontroller-Based Filing Cabinet with Biometric Technology


for STI College of Meycauayan

L-5

You might also like