Okay, so this is for my A-Level computing coursework. I have a form which is an entry form, so the user enters their details.
I already have this, I have also made a class, because it's required to get the marks for the coursework, at the moment the class takes what's entered and then displays it in pop-up message box
I need to be able to take the details, write them to a text file and then read it again and display it in a nice little table to review.
Here's my code so far
Public Class InvoiceProfile
Private InvoiceNo As String
Private JobDescription As String
Private LabourCost As Decimal
Private MaterialCost As Decimal
Private VAT As Decimal
Private TotalCosts As Decimal
Public Property InvoiceNum() As String
Get
Return InvoiceNo
End Get
Set(ByVal value As String)
InvoiceNo = value
End Set
End Property
Public Property JobDesc() As String
Get
Return JobDescription
End Get
Set(ByVal value As String)
JobDescription = value
End Set
End Property
Public Property LabourCosts() As Decimal
Get
Return LabourCost
End Get
Set(ByVal value As Decimal)
LabourCost = value
End Set
End Property
Public Property MaterialCosts() As Decimal
Get
Return MaterialCost
End Get
Set(ByVal value As Decimal)
MaterialCost = value
End Set
End Property
Public Property VATCost() As Decimal
Get
Return VAT
End Get
Set(ByVal value As Decimal)
VAT = value
End Set
End Property
Public Property TotalCost() As Decimal
Get
Return TotalCosts
End Get
Set(ByVal value As Decimal)
TotalCosts = value
End Set
End Property
End Class
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim Invoice As New InvoiceProfile
Invoice.InvoiceNum = InvoiceNumberBox.Text()
Invoice.JobDesc = InvoiceJobDesciptionBox.Text
Invoice.LabourCosts = InvoiceLabourCostBox.Text
Invoice.MaterialCosts = InvoiceMaterialCostBox.Text
Invoice.VATCost = 1 - InvoiceVATLabel.Text
Invoice.TotalCost = Invoice.MaterialCosts + Invoice.LabourCosts
Invoice.TotalCost = Invoice.TotalCost * Invoice.VATCost
MsgBox(Invoice.InvoiceNum & Invoice.JobDesc & Invoice.LabourCosts & Invoice.MaterialCosts _
& Invoice.VATCost & " " & Invoice.TotalCost)
Dim StreamToWrite As StreamWriter
StreamToWrite = New StreamWriter("C:\vb10sbs\chap13\output.txt")
StreamToWrite.Write(Invoice)
StreamToWrite.Close()
End Sub
When I do this it just writes "Computing_A2_Project.InvoiceProfile" in the text file. Not all of the entered data.
Can you see what I'm trying to do?
Thanks.
Any ideas?
Visual Studio 2010. Complete Novice to the language, but not to coding.
I already have this, I have also made a class, because it's required to get the marks for the coursework, at the moment the class takes what's entered and then displays it in pop-up message box
I need to be able to take the details, write them to a text file and then read it again and display it in a nice little table to review.
Here's my code so far
Public Class InvoiceProfile
Private InvoiceNo As String
Private JobDescription As String
Private LabourCost As Decimal
Private MaterialCost As Decimal
Private VAT As Decimal
Private TotalCosts As Decimal
Public Property InvoiceNum() As String
Get
Return InvoiceNo
End Get
Set(ByVal value As String)
InvoiceNo = value
End Set
End Property
Public Property JobDesc() As String
Get
Return JobDescription
End Get
Set(ByVal value As String)
JobDescription = value
End Set
End Property
Public Property LabourCosts() As Decimal
Get
Return LabourCost
End Get
Set(ByVal value As Decimal)
LabourCost = value
End Set
End Property
Public Property MaterialCosts() As Decimal
Get
Return MaterialCost
End Get
Set(ByVal value As Decimal)
MaterialCost = value
End Set
End Property
Public Property VATCost() As Decimal
Get
Return VAT
End Get
Set(ByVal value As Decimal)
VAT = value
End Set
End Property
Public Property TotalCost() As Decimal
Get
Return TotalCosts
End Get
Set(ByVal value As Decimal)
TotalCosts = value
End Set
End Property
End Class
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim Invoice As New InvoiceProfile
Invoice.InvoiceNum = InvoiceNumberBox.Text()
Invoice.JobDesc = InvoiceJobDesciptionBox.Text
Invoice.LabourCosts = InvoiceLabourCostBox.Text
Invoice.MaterialCosts = InvoiceMaterialCostBox.Text
Invoice.VATCost = 1 - InvoiceVATLabel.Text
Invoice.TotalCost = Invoice.MaterialCosts + Invoice.LabourCosts
Invoice.TotalCost = Invoice.TotalCost * Invoice.VATCost
MsgBox(Invoice.InvoiceNum & Invoice.JobDesc & Invoice.LabourCosts & Invoice.MaterialCosts _
& Invoice.VATCost & " " & Invoice.TotalCost)
Dim StreamToWrite As StreamWriter
StreamToWrite = New StreamWriter("C:\vb10sbs\chap13\output.txt")
StreamToWrite.Write(Invoice)
StreamToWrite.Close()
End Sub
When I do this it just writes "Computing_A2_Project.InvoiceProfile" in the text file. Not all of the entered data.
Can you see what I'm trying to do?
Thanks.
Any ideas?
Visual Studio 2010. Complete Novice to the language, but not to coding.