問題は、顧客領収書フォームのテキストボックスにコーディングが表示されないことです。
解決策はありますか?
'This is the coding for the for the SelfCheckOutForm.
'======================================================================================================================================
Option Strict On
'Declare the UPC Structure
Structure UPC
Friend UPCString As String
Friend ProductString As String
Friend DesriptString As String
Friend WeightDecimal As Decimal
Friend PriceDecimal As Decimal
End Structure
Public Class SelfCheckout
'declare structure variables
Dim PriceArray(4) As UPC
'====================================================================================================================================
'declare variables
Friend TotalPriceDecimal As Decimal
Friend TotalWeightDecimal As Decimal
Friend TotalItemsInteger As Integer
Friend MessageString As String
Friend totalString As String
Friend numberOfItemsString As String
Friend weightOfItemsString As String
'=======================================================================================================================================
'ListBox Coding with Arrays
Private Sub SelfCheckout_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Load My List Box with the UPC Codes
UPCListBox.Items.Add("12345")
UPCListBox.Items.Add("23451")
UPCListBox.Items.Add("34512")
UPCListBox.Items.Add("45123")
UPCListBox.Items.Add("51234")
'-------------------------------------------------------------------------------
'Create my UPC Array Values
PriceArray(0).UPCString = "12345"
PriceArray(1).UPCString = "23451"
PriceArray(2).UPCString = "34512"
PriceArray(3).UPCString = "45123"
PriceArray(4).UPCString = "51234"
'-------------------------------------------------------------------------------
'Create my Product Array Values
PriceArray(0).ProductString = "Computer Tower"
PriceArray(1).ProductString = "Laptop"
PriceArray(2).ProductString = "Flatscreen Monitor"
PriceArray(3).ProductString = "Wifi Router"
PriceArray(4).ProductString = "All-In-One Printer"
'------------------------------------------------------------------------------
'Create my Description Array Variables
PriceArray(0).DesriptString = "A computer that can do basic office work."
PriceArray(1).DesriptString = "A computer you can take with you."
PriceArray(2).DesriptString = "A Computer monitor to go with the tower."
PriceArray(3).DesriptString = "You can now go online anywhere in your house!"
PriceArray(4).DesriptString = "It has a Scanner and a fax machine built in!"
'-------------------------------------------------------------------------------
'Create my Price Array Values
PriceArray(0).PriceDecimal = 499.95D
PriceArray(1).PriceDecimal = 550.5D
PriceArray(2).PriceDecimal = 170.95D
PriceArray(3).PriceDecimal = 70.65D
PriceArray(4).PriceDecimal = 199.95D
'------------------------------------------------------------------------------
'Create my Weight Array Values
PriceArray(0).WeightDecimal = 15
PriceArray(1).WeightDecimal = 5
PriceArray(2).WeightDecimal = 8
PriceArray(3).WeightDecimal = 3
PriceArray(4).WeightDecimal = 18
End Sub
'===============================================================================================================================================
'Textbox.text from UPC listbox coding
Private Sub UPCListBox_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UPCListBox.SelectedIndexChanged
'Show UPC in UPC TextBox
UPCTextBox.Text = UPCListBox.Text
'Looking up the Product
'Table Look up Do/Loop
Dim myBoolean As Boolean 'True = Found the Product
Dim indexInteger As Integer = 0
Do Until myBoolean Or indexInteger > 4
With Me
If UPCTextBox.Text = PriceArray(indexInteger).UPCString Then
ProductTextBox.Text = (PriceArray(indexInteger).ProductString) 'Fills Product TextBox
DescriptTextBox.Text = (PriceArray(indexInteger).DesriptString) 'Fill Description TextBox
WeightTextBox.Text = FormatNumber(PriceArray(indexInteger).WeightDecimal) 'Fill Weight Textbox
PriceTextBox.Text = FormatCurrency(PriceArray(indexInteger).PriceDecimal) 'Fill Price Textbox
myBoolean = True
Else
indexInteger += 1
End If
End With
Loop
End Sub
'====================================================================================================================================================
'Message Box Coding
Private Sub PurchaseButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PurchaseButton.Click
If PurchaseButton.Enabled And PriceTextBox.Text <> "" Then
'Calculate the quantities
TotalItemsInteger += 1 'counts the purchases made
TotalPriceDecimal += CDec(PriceTextBox.Text) 'Adds the purchases together
TotalWeightDecimal += CDec(WeightTextBox.Text) 'Adds the wieghts of purchases together
'----------------------------------------------------------------------------------------------------------------
'Building Meassage Box for purchase button
numberOfItemsString = TotalItemsInteger.ToString()
totalString = TotalPriceDecimal.ToString("C")
weightOfItemsString = TotalWeightDecimal.ToString("N")
MessageString = "Total Items: " & numberOfItemsString &
Environment.NewLine & "Total Weight: " & weightOfItemsString &
Environment.NewLine & "Total Price: " & totalString
'------------------------------------------------------------------------------------------------------------------
'Display Message box
MessageBox.Show(MessageString, "Items Purchased:", MessageBoxButtons.OK)
End If
End Sub
Private Sub CloseOrderButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseOrderButton.Click
CustomerReceiptForm.ShowDialog()
End Sub
End Class
'Programmer: A.Rose
'Date: 10/8/13
'Description: The CustomerReceiptForm provides information on how many items, the total weight and price
'of the combined purchase.
'This is The coding for the CustomerReceiptForm.
'===============================================================================================================================================
Option Strict On
Public Class CustomerReceiptForm
'Function of the Enjoy your Purchase Button
Private Sub CloseBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseBtn.Click
Me.Close()
SelfCheckout.Close()
End Sub
'=================================================================================================================================================
'coding for filling in the Textboxes with the appropriate information
'-----------------------------------------------------------------------
'Total Price of Purchases
Private Sub TotalItemsTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TotalItemsTextBox.TextChanged
TotalItemsTextBox.Text = SelfCheckout.TotalItemsInteger.ToString()
End Sub
'-----------------------------------------------------------------------
'Total Weight of Purchases
Private Sub TotalWeightTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TotalWeightTextBox.TextChanged
TotalWeightTextBox.Text = SelfCheckout.TotalWeightDecimal.ToString("N")
End Sub
'------------------------------------------------------------------------
'Total Price of Purchases
Private Sub TotalCostTextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TotalCostTextBox.TextChanged
TotalCostTextBox.Text += SelfCheckout.TotalPriceDecimal.ToString("C")
End Sub
'-------------------------------------------------------------------------
End Class