Public Class Registration
Private _intNumber As Integer
Private _intExpiryMonth As Integer
_intNumber=Number
_intExpiryMonth=ExpiryMonth
Public Function getRegNumber() As Integer
_intNumber=RegNumber
End Sub
Public Sub setRegNumber as
Monday, November 15, 2010
Car AND MotorBike Classes
Remember : A Child cannot exist without a parent!!
Public Class Car
InheritsVehicle
Private _intNumberOfPassengers As Integer
Public Sub New(Make As String, Model As String, RegNumber As Integer,RegExpiryDate As Integer)
MyBase.New(make,model,RegNumber,RegExpiryDate)
_intNumberOfPassengers=NumberOfPassengers
Public Sub New(Make As String, Model As String, RegNumber As Integer,RegExpiryDate As Integer,GeneralNotes As String, NumberOfPassengers As Integer)
MyBase.New(make,model,RegNumber,RegExpiryaDate,GeneralNotes)
int_NumberOfPassengers=NumberOfPassengers
Public Function getNumberOfPassengers()AsInteger
Return_intNumberOfPassengers
End Function
Public Sub setNumberOfPassengers(NumberOfPassengers As Integer)
_intNumberOfPassengers=NumberOfPassengers
End Sub
Public Sub AddToPassengers(NumberOfPassengers As Integer)
_intNumberOfPassengers +=NumberOfPassengers
End Class
____________________________________________________
Public Class MotorBike
InheritsVehicle
Public Sub New(Make As String, Model As String, RegNumber As Integer,RegExpiryDate As Integer)
Public Sub New(Make As String, Model As String, RegNumber As Integer,RegExpiryDate As Integer,GeneralNotes As String, NumberOfPassengers As Integer)
Public Class Car
InheritsVehicle
Private _intNumberOfPassengers As Integer
Public Sub New(Make As String, Model As String, RegNumber As Integer,RegExpiryDate As Integer)
MyBase.New(make,model,RegNumber,RegExpiryDate)
_intNumberOfPassengers=NumberOfPassengers
Public Sub New(Make As String, Model As String, RegNumber As Integer,RegExpiryDate As Integer,GeneralNotes As String, NumberOfPassengers As Integer)
MyBase.New(make,model,RegNumber,RegExpiryaDate,GeneralNotes)
int_NumberOfPassengers=NumberOfPassengers
Public Function getNumberOfPassengers()AsInteger
Return_intNumberOfPassengers
End Function
Public Sub setNumberOfPassengers(NumberOfPassengers As Integer)
_intNumberOfPassengers=NumberOfPassengers
End Sub
Public Sub AddToPassengers(NumberOfPassengers As Integer)
_intNumberOfPassengers +=NumberOfPassengers
End Class
____________________________________________________
Public Class MotorBike
InheritsVehicle
Public Sub New(Make As String, Model As String, RegNumber As Integer,RegExpiryDate As Integer)
Public Sub New(Make As String, Model As String, RegNumber As Integer,RegExpiryDate As Integer,GeneralNotes As String, NumberOfPassengers As Integer)
Task Three
Public MustInherit Class Vehicle
Protected _strName As String
Protected _strModel As String
Protected _strGeneralNotes As String
Protected _VechicleRegistration As Registration(RegNumber,RegExpiryDate)
Public Sub New(Make As String, Model As String, RegNumber As Integer,RegExpiryDate As Integer)
_strMake = Make
_strModel=Model
_VechicleRegistration = New Registration
Public Sub New(Make As String, Model As String, RegNumber As Integer,RegExpiryDate As Integer,GeneralNotes As String)
_strMake = Make
_strModel=Model
_strGeneralNotes=GeneralNotes
_VechicleRegistration = New Registration
Public Function getMake()As String
Return_strMake
End Function
Public Sub setMake(Make As String)
_strMake=Make
End Sub
Public Function getMocel()As String
Return_strModel
End Function
Public Sub setModel(Model As String)
_strModel=Model
End Sub
Public Function getGeneralNotes()As String
Return_strGeneralNotes
End Function
Public Sub setGeneralNotes(GeneralNotes As String)
_strGeneralNotes=GeneralNotes
End Sub
Public Function getVechicleRegistration()As Registration
Return_strVechicleRegistration
End Function
Public Sub setVechicleRegistration(ARegistration As Registration)
_strVechicleRegistration=ARegistration
End Sub
Public Sub AddToGeneralNotes(Notes As String)
_strGeneralNotes &=Notes
End Sub
Protected _strName As String
Protected _strModel As String
Protected _strGeneralNotes As String
Protected _VechicleRegistration As Registration(RegNumber,RegExpiryDate)
Public Sub New(Make As String, Model As String, RegNumber As Integer,RegExpiryDate As Integer)
_strMake = Make
_strModel=Model
_VechicleRegistration = New Registration
Public Sub New(Make As String, Model As String, RegNumber As Integer,RegExpiryDate As Integer,GeneralNotes As String)
_strMake = Make
_strModel=Model
_strGeneralNotes=GeneralNotes
_VechicleRegistration = New Registration
Public Function getMake()As String
Return_strMake
End Function
Public Sub setMake(Make As String)
_strMake=Make
End Sub
Public Function getMocel()As String
Return_strModel
End Function
Public Sub setModel(Model As String)
_strModel=Model
End Sub
Public Function getGeneralNotes()As String
Return_strGeneralNotes
End Function
Public Sub setGeneralNotes(GeneralNotes As String)
_strGeneralNotes=GeneralNotes
End Sub
Public Function getVechicleRegistration()As Registration
Return_strVechicleRegistration
End Function
Public Sub setVechicleRegistration(ARegistration As Registration)
_strVechicleRegistration=ARegistration
End Sub
Public Sub AddToGeneralNotes(Notes As String)
_strGeneralNotes &=Notes
End Sub
Task Two
Week 4 and 5 and Week 10 = Resources
Coded in the WRITE Button
"WE PUT A TRY HERE SO THAT WE CAN CATCH AN EXCEPTION WHEN IT OCCURS"
Try
"IF STATMENT BEGINS"
If IO .File.Exists("Numbers.txt") Then
"DECLARE A STRING FOR MYNUMBERS WITH AN UPPERBOUND OF 4 AS IN THE ARRAY THERE ARE 5 ITEMS BUT AN ARRAY BEGINS FROM 0"
Dim MyNumbers (4) As String
"DECLARE THE STREAMREADER WHICH IS GOING TO READ OUR FILE NUMBERS.TXT"
Dim inFile As IO.StreamReader
inFile=IO.File.OpenText("Numbers.txt")
Dim intCount As Integer = 0
While InFile.Peek<>-1
MyNumbers(intcount)=inFile.ReadLine
inCount +=1
End While
inFile.Close()
Else
"A MESSAGE BOX WILL APPEAR SAYING FILE DOES NOT EXIST IF THE FILE CANNOT BE FOUND
MsgBox("File does not exist")
"WE END OUR END IF STATMENT"
End If
"HERE WE CATCH OUR EXCEPTION"
Catch AnyTypeOfException As Exception
"OUR MESSAGE BOX THAT APPEARS WHEN SOMETHING GOES WRONG AND
MsgBox("Sorry,something went wrong!")
"HERE WE END OUR TRY STATEMENT"
End Try
________________________________________
Try
If IO.File.Exists ("Numbers.txt")Then
Dim Outfile As IO.StreamWriter
outfile=IO.File.AppendText("Number.txt")
For intCount = 0 to MyNumbers.Length - 1
outfile.WriteLine(MyNumbers(intCount))
Next
outfile.Close()
Else
MsgBox("File Not Found!")
End If
Catch AnyTpyeOfException As Exception
End Try
Coded in the WRITE Button
"WE PUT A TRY HERE SO THAT WE CAN CATCH AN EXCEPTION WHEN IT OCCURS"
Try
"IF STATMENT BEGINS"
If IO .File.Exists("Numbers.txt") Then
"DECLARE A STRING FOR MYNUMBERS WITH AN UPPERBOUND OF 4 AS IN THE ARRAY THERE ARE 5 ITEMS BUT AN ARRAY BEGINS FROM 0"
Dim MyNumbers (4) As String
"DECLARE THE STREAMREADER WHICH IS GOING TO READ OUR FILE NUMBERS.TXT"
Dim inFile As IO.StreamReader
inFile=IO.File.OpenText("Numbers.txt")
Dim intCount As Integer = 0
While InFile.Peek<>-1
MyNumbers(intcount)=inFile.ReadLine
inCount +=1
End While
inFile.Close()
Else
"A MESSAGE BOX WILL APPEAR SAYING FILE DOES NOT EXIST IF THE FILE CANNOT BE FOUND
MsgBox("File does not exist")
"WE END OUR END IF STATMENT"
End If
"HERE WE CATCH OUR EXCEPTION"
Catch AnyTypeOfException As Exception
"OUR MESSAGE BOX THAT APPEARS WHEN SOMETHING GOES WRONG AND
MsgBox("Sorry,something went wrong!")
"HERE WE END OUR TRY STATEMENT"
End Try
________________________________________
Try
If IO.File.Exists ("Numbers.txt")Then
Dim Outfile As IO.StreamWriter
outfile=IO.File.AppendText("Number.txt")
For intCount = 0 to MyNumbers.Length - 1
outfile.WriteLine(MyNumbers(intCount))
Next
outfile.Close()
Else
MsgBox("File Not Found!")
End If
Catch AnyTpyeOfException As Exception
End Try
Task One
Coded in the READ button
Try
If IO .File.Exists("Numbers.txt") Then
Dim MyNumbers (4) As String
Dim inFile As IO.StreamReader
inFile=IO.File.OpenText("Numbers.txt")
Dim intCount As Integer = 0
While InFile.Peek<>-1
MyNumbers(intcount)=inFile.ReadLine
inCount +=1
End While
inFile.Close()
Else
MsgBox("File does not exist")
End If
Catch AnyTypeOfException As Exception
MsgBox("Sorry,something went wrong!")
End Try
Try
If IO .File.Exists("Numbers.txt") Then
Dim MyNumbers (4) As String
Dim inFile As IO.StreamReader
inFile=IO.File.OpenText("Numbers.txt")
Dim intCount As Integer = 0
While InFile.Peek<>-1
MyNumbers(intcount)=inFile.ReadLine
inCount +=1
End While
inFile.Close()
Else
MsgBox("File does not exist")
End If
Catch AnyTypeOfException As Exception
MsgBox("Sorry,something went wrong!")
End Try
Tuesday, October 19, 2010
Content Management Systems
Joomla = makes websites, manages sites, blogs and polls, flexibility, easy to use.
Drupal = same as above
Word Press = mainly blogging but also same as the two above
Moodle = education based, interactive, classes students
Zen Cart = shopping and e commerce
Drupal = same as above
Word Press = mainly blogging but also same as the two above
Moodle = education based, interactive, classes students
Zen Cart = shopping and e commerce
Monday, October 18, 2010
Select Operation
Public Class Form1
'START OF DATABASE OPERATION!!!!!!
Private Sub btnGetCustomerNames_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetCustomerNames.Click
Dim strConnectionString As String = "Provider = Microsoft.Ace.OLEDB.12.0;" & _
"Data Source = F:/MyFolder/Filters.accdb "
Dim MyConnection As New OleDb.OleDbConnection(strConnectionString)
MyConnection.Open()
Dim MyCommand As New OleDb.OleDbCommand("SELECT * FROM customers", MyConnection)
Dim MyDataSet As New Data.DataSet
Dim MyDataAdapter As New OleDb.OleDbDataAdapter(MyCommand)
MyDataAdapter.Fill(MyDataSet, "QueryResults")
MyConnection.Close()
'END OF DATABASE OPERATION!!
LstCustomerNames.DataSource = MyDataSet.Tables("QueryResults")
LstCustomerNames.DisplayMember = "FirstName"
LstCustomerNames.ValueMember = "CustomerID"
End Sub
End Class
'START OF DATABASE OPERATION!!!!!!
Private Sub btnGetCustomerNames_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGetCustomerNames.Click
Dim strConnectionString As String = "Provider = Microsoft.Ace.OLEDB.12.0;" & _
"Data Source = F:/MyFolder/Filters.accdb "
Dim MyConnection As New OleDb.OleDbConnection(strConnectionString)
MyConnection.Open()
Dim MyCommand As New OleDb.OleDbCommand("SELECT * FROM customers", MyConnection)
Dim MyDataSet As New Data.DataSet
Dim MyDataAdapter As New OleDb.OleDbDataAdapter(MyCommand)
MyDataAdapter.Fill(MyDataSet, "QueryResults")
MyConnection.Close()
'END OF DATABASE OPERATION!!
LstCustomerNames.DataSource = MyDataSet.Tables("QueryResults")
LstCustomerNames.DisplayMember = "FirstName"
LstCustomerNames.ValueMember = "CustomerID"
End Sub
End Class
Subscribe to:
Posts (Atom)