0% found this document useful (0 votes)
42 views14 pages

Source Code

This document contains source code for a student registration form application. It includes code to: 1) Map student grades from text entries to numeric values from 0-5. 2) Calculate a student's total score and grade point average across multiple courses. 3) Save the student's registration data and grades to a database.

Uploaded by

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

Source Code

This document contains source code for a student registration form application. It includes code to: 1) Map student grades from text entries to numeric values from 0-5. 2) Calculate a student's total score and grade point average across multiple courses. 3) Save the student's registration data and grades to a database.

Uploaded by

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

SOURCE CODE

FORM REGISTRATION CODE:

Imports System.Data.OleDb

PublicClassfrmRegistration
Const English AsInteger = 2
Const GeneralBiology AsInteger = 3
Const GeneralChemistry AsInteger = 2
ConstGeneralChemistryII AsInteger = 3
Const PracticalChemistry AsInteger = 1
Const ElemenatryMaths AsInteger = 3
Const GeneralPhysics AsInteger = 3
Const BasicPracticalPhysics AsInteger = 1
Const IntroductionToStatistics AsInteger = 3
Const NigerianCulture AsInteger = 2
Const Biothics AsInteger = 1
Dim tempEnglish, tempBiology, tempChemistry, tempChemistryII,
tempPracticalChemistry, tempElementaryMaths AsIntegerDim
tempGeneralPhysics, tempPracticalPhysics,
tempIntroductionStatistic, tempNigerianPeople, tempBiothics AsInteger
Dim tempCourseTotal AsInteger
Dim tempGP AsDecimal
DimtempEnglishII, tempFrench, tempGeneralPhysicsII,
tempPhysicsLaboratory, tempBasicChemistry, tempIntroductionComputer
AsInteger
Dim tempElementaryMathsII, tempElementaryMathsIII AsInteger

PrivateSub CalculateGetGP()
'get and map the grade point of txtenglish
If txtEnglish.Text = "A"Then
'return 5 tempEnglish
=5
ElseIf txtEnglish.Text = "B"Then
'return 4 tempEnglish
=4
ElseIf txtEnglish.Text = "C"Then'return 3
tempEnglish = 3

1
ElseIf txtEnglish.Text = "D"Then
'return 2 tempEnglish = 2
ElseIf txtEnglish.Text = "E"Then
'Return 1 tempEnglish = 1
ElseIftxtEnglish.Text = "F"Then
'return 0 tempEnglish
=0
EndIf

'get the mark of txtbiology


If txtBiology.Text = "A"Then
'return 5 tempBiology = 5
ElseIftxtBiology.Text = "B"Then
'return 4 tempBiology = 4
ElseIf txtBiology.Text = "C"Then
'return 3
tempBiology = 3

ElseIf txtBiology.Text = "D"Then


'return 2 tempBiology = 2
ElseIf txtBiology.Text = "E"Then
'return 1 tempBiology = 1
ElseIf txtBiology.Text = "F"Then
'return 0 tempBiology
=0
EndIf

'get the mark for general chemistry


If txtChemistry.Text = "A"Then
'return 5 tempChemistry = 5
ElseIf txtChemistry.Text = "B"Then
'return 4
tempChemistry = 4
ElseIf txtChemistry.Text
= "C"Then
'return 3 tempChemistry
=3
ElseIf txtChemistry.Text = "D"Then
'return 2 tempChemistry
=2
2
ElseIf txtChemistry.Text = "E"Then
'return 1 tempChemistry = 1
ElseIf txtChemistry.Text = "F"Then
'return 0 tempChemistry
=0
EndIf

'get the mark for General chemistry II


If txtChemistryII.Text = "A"Then
'return 5 tempChemistryII
=5
ElseIf txtChemistryII.Text = "B"Then
'return 4 tempChemistryII
=4
ElseIf txtChemistryII.Text = "C"Then
'return 3 tempChemistryII
=3
ElseIf txtChemistryII.Text = "D"Then
'return 2 tempChemistryII
=2
ElseIf txtChemistryII.Text = "E"Then
'return 1 tempChemistryII
=1
ElseIf txtChemistryII.Text = "F"Then
'retturn 0 tempChemistryII
=0
EndIf

'get the mark of txtPracticalchemistry


If txtPracticalChemistry.Text = "A"Then
''return 5
tempPracticalChemistry = 5
ElseIf txtPracticalChemistry.Text = "B"Then'return 4

3
tempPracticalChemistry = 4
ElseIftxtPracticalChemistry.Text = "C"Then
'return 3
tempPracticalChemistry = 3
ElseIf txtPracticalChemistry.Text = "D"Then
'return 2
tempPracticalChemistry = 2
ElseIf txtPracticalChemistry.Text = "E"Then
'return 1
tempPracticalChemistry = 1
ElseIf txtPracticalChemistry.Text = "F"Then
'return 0
tempPracticalChemistry = 0
EndIf

'get the mark of txtelementarymaths


If txtElementaryMaths.Text = "A"Then
'return 5
tempElementaryMaths = 5 ElseIf
txtElementaryMaths.Text = "B"Then
'return 4
tempElementaryMaths = 4 ElseIf
txtElementaryMaths.Text = "C"Then
'retrun 3
tempElementaryMaths = 3
ElseIf txtElementaryMaths.Text = "D"Then
'return 2
tempElementaryMaths = 2 ElseIf
txtElementaryMaths.Text = "E"Then
'return 1
tempElementaryMaths = 1 ElseIf
txtElementaryMaths.Text = "F"Then
'return 0
tempElementaryMaths = 0
If

ElseIf
4
'return 4

ElseIf

ElseIf

EndIf

'get the mark of General Physics


txtGeneralPhysics.Text = "A"Then
'return 5 tempGeneralPhysics = 5
txtGeneralPhysics.Text = "B"Then
tempGeneralPhysics = 4
txtGeneralPhysics.Text = "C"Then
'return 3 tempGeneralPhysics
=3
txtGeneralPhysics.Text = "D"Then
'return 2
tempGeneralPhysics = 2
ElseIf txtGeneralPhysics.Text = "E"Then
'return 1
tempGeneralPhysics = 1
ElseIf txtGeneralPhysics.Text = "F"Then
'return 0
tempGeneralPhysics = 0
EndIf

''get the mark of Basic Practical physics


If txtPracticalPhysics.Text = "A"Then
'return 5
tempPracticalPhysics = 5
ElseIftxtPracticalPhysics.Text = "B"Then
'return 4
tempPracticalPhysics = 4
ElseIf txtPracticalPhysics.Text = "C"Then
If

ElseIf
5
'return 4

ElseIf

ElseIf

'return 3
tempPracticalPhysics = 3
ElseIf txtPracticalPhysics.Text = "D"Then
'Return 2
tempPracticalPhysics = 2
ElseIf txtPracticalPhysics.Text = "E"Then
tempGeneralPhysics = 1
ElseIf txtPracticalPhysics.Text = "F"Then
'return 0
tempPracticalPhysics = 0
EndIf

'get the mark for Introduction statistical


txtIntroductionStatistics.Text = "A"Then
'return 5
tempIntroductionStatistic = 5
txtIntroductionStatistics.Text =
"B"ThentempIntroductionStatistic = 4
txtIntroductionStatistics.Text = "C"Then
'return 3
tempIntroductionStatistic = 3
txtIntroductionStatistics.Text = "D"Then
'return 2
tempIntroductionStatistic = 2
ElseIftxtIntroductionStatistics.Text = "E"Then
'return 1
tempIntroductionStatistic = 1
ElseIf txtIntroductionStatistics.Text = "F"Then
'return 0
If

ElseIf
6
'return 4

ElseIf

ElseIf

tempIntroductionStatistic = 0
EndIf

'get the mark of nigerians peoples and culture


If txtNigerianPeoples.Text = "A"Then
'return 5
tempNigerianPeople = 5
ElseIf txtNigerianPeoples.Text = "B"Then
'return 4
tempNigerianPeople = 4
ElseIf txtNigerianPeoples.Text = "C"Then
'return 3
tempNigerianPeople = 3
ElseIf txtNigerianPeoples.Text = "D"Then
'return 2
tempNigerianPeople = 2
ElseIftxtNigerianPeoples.Text = "E"Then
'return 1
tempNigerianPeople = 1
ElseIf txtNigerianPeoples.Text = "F"Then
'return = 0
EndIf

'get the mark of txtBiothics.Text =


"A"Then
'return 5 tempBiothics = 5
txtBiothics.Text = "B"Then

If

ElseIf
7
'return 4

ElseIf

ElseIf

tempBiothics = 4
txtBiothics.Text = "C"Then
'return 3 tempBiothics = 3
txtBiothics.Text = "D"Then
'return 2
tempBiothics = 2
ElseIf txtBiothics.Text = "E"Then
'return 1
tempBiothics = 1
ElseIf txtBiothics.Text = "F"Then
'return 0
tempBiothics = 0
EndIf
'get the total score from each course
tempCourseTotal = tempEnglish + tempBiology + tempChemistry
+ tempChemistryII + tempPracticalChemistry + _
tempElementaryMaths + tempGeneralPhysics +
tempPracticalPhysics + tempIntroductionStatistic
+_ tempNigerianPeople + tempBiothics
'get the current grade point of the student
tempGP = tempCourseTotal / 11
txtGradepoint.Text = FormatNumber(tempGP, 2)
EndSub
PrivateSub SaveDataToDatabase()

'calling up a subrountine to compute the Gp before strorage


CalculateGetGP()
If

ElseIf
8
'return 4

ElseIf

ElseIf

TRANSConnection()
Dim con AsNewOleDbConnection(connection)
Dim sqlcmd AsString
con.Open()
sqlcmd = "INSERT INTO SEMESTERRECORD "& _

"(NAME,DATEOFBIRTH,LOCALGOVERNMENT,STATEOFORIGIN,RESIDEN
TIALADDRESS,TELEPHONENUMBER,"& _

"NEXTOFKIN,RELATIONSHIP,REGISTRATIONNUMBER,FACULTY,DEPART
MENT,CURRENTLEVEL,"& _
"SEMESTER,CURRENTGRADEPOINT,ENGLISH,BIOLOGY,GENERALCHEMI
STRY,GENERALCHEMISTRYII,PRACTICALCHEMISTRY,"& _

"ELEMENTARYMATHS,GENERALPHYSICS,BASICPRACTICALPHYSICS,INT
ROSTATISTICS,NIGERIANPEOPLE,BIOTHICS)"& _
"VALUES('"& txtName.Text &"','"& txtDateofBirth.Text &"','"
& txtLocalGov.Text &"','"& txtState.Text &"','"& _
txtResidentialAddress.Text &"','"& txtTelephone.Text &"','"&
txtNextofkin.Text &"','"& _ cboRelationship.Text &"','"&
txtRegistrationNumber.Text &
"','"& cboFaculty.Text &"','"& _
cboDepartment.Text &"','"& cboLevel.Text &"','"&
cboSemester.Text &"','"& txtGradepoint.Text & _
"','"& txtEnglish.Text &"','"& txtBiology.Text &"','"&

If

ElseIf
9
'return 4

ElseIf

ElseIf

txtChemistry.Text &"','"& txtChemistryII.Text & _


"','"& txtPracticalChemistry.Text &"','"&
txtElementaryMaths.Text &"','"& txtGeneralPhysics.Text & _
"','"& txtPracticalPhysics.Text &"','"&
txtIntroductionStatistics.Text &"','"& txtNigerianPeoples.Text &"','"&
txtBiothics.Text &"')"
Dim command AsNewOleDbCommand(sqlcmd, con)
Dim count AsInteger = command.ExecuteNonQuery()
MsgBox("The record was saved successfully",
MsgBoxStyle.Information, "itranx")
btnConfirm.Text = "&Confirm"

EndSub

PrivateSub btnCompute_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles btnCompute.Click
'calling up a sunrountine
CalculateGetGP()
EndSub

PrivateSub btnConfirm_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles btnConfirm.Click
'calling up a subrountine
SaveDataToDatabase()
EndSub

If

ElseIf
10
'return 4

ElseIf

ElseIf

PrivateSub frmRegistration_Load(ByVal sender As System.Object,


ByVal e As System.EventArgs) HandlesMyBase.Load

EndSub

PrivateSubbtnCancel_Click(ByVal sender As System.Object, ByVal e


As System.EventArgs) Handles btnCancel.Click
Me.Close()
EndSub
EndClass

If

ElseIf
11
'return 4

ElseIf

ElseIf

APPLICATION CONFIGURATION
<?xmlversion="1.0"?>
<configuration>
<system.diagnostics>
<sources>
<!-- This section defines the logging configuration for
My.Application.Log -->
<sourcename="DefaultSource"switchName="DefaultSwitch">
If

ElseIf
12
'return 4

ElseIf

ElseIf

<listeners>
<addname="FileLog"/>
<!-- Uncomment the below section to write to the
Application Event Log -->
<!--<add name="EventLog"/>-->
</listeners>
</source>
</sources><switches>
<addname="DefaultSwitch"value="Information"/>
</switches>
<sharedListeners><addname="FileLog"type="Microsof
t.VisualBasic.Logging.FileLogTraceListener,
Microsoft.VisualBasic, Version=8.0.0.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a,
processorArchitecture=MSIL"initializeData="FileLogWriter"/>
<!-- Uncomment the below section and replace
APPLICATION_NAME with the name of your application to write to the
Application Event Log -->
<!--<add name="EventLog"
type="System.Diagnostics.EventLogTraceListener"
initializeData="APPLICATION_NAME"/>-->
</sharedListeners>
</system.diagnostics>
<startup><supportedRuntimeversion="v4.0"
sku=".NETFramework,Version=v4.0"/></startup></
configuration>APPENDIX 2 (INTERFACES)

If

ElseIf
13
'return 4

ElseIf

ElseIf

If

ElseIf
14

You might also like