使用以下代码我试图隐藏文本框,但是,脚本不会运行。我已在多个浏览器中调试,没有任何操作。谁能告诉我这是什么问题。
Module Module1
' IMPUT VARIABLES:
Private ProductNumberInteger As Integer
Private ProductDescriptionString As String
Private WholeSalePriceDecimal As Decimal
Private MarkupCodeInteger As Integer
Private QuantitySoldInteger As Integer
' CALCULATED VARIABLES AFTER PROCESSING:
Private CalculatedMarkupAmountDecimal As Decimal '
Private CalculatedRetailPriceDecimal As Decimal
Private CalculatedDiscountAmountDecimal As Decimal
Private CalculatedDiscountedPriceDecimal As Decimal
Private CalculatedTotalEarnedDecimal As Decimal
Private CalculatedTotalProfitDecimal As Decimal
' ASSIGNED FIELDS:
Private MarkupRateDecimal
Private DiscountPercentRateDecimal
' CONSTANT VARIABLES:
Private MARKUP_CODE_1_DECIMAL As Decimal = 1.05
Private MARKUP_CODE_2_DECIMAL As Decimal = 1.07
Private MARKUP_CODE_3_DECIMAL As Decimal = 1.1
Private MARKUP_CODE_4_DECIMAL As Decimal = 1.2
Private MARKUP_CODE_5_DECIMAL As Decimal = 1.25
Private CurrentRecord() As String
Private TURKEYSALESFILE As New Microsoft.VisualBasic.FileIO.TextFieldParser("THANKSWk44.txt")
' ACCUMULATORS
Private AccumFinalTotalWholesalePriceDecimal As Decimal
Private AccumFinalTotalMarkupAmountDecimal As Decimal
Private AccumFinalTotalProfitDecimal As Decimal
Private AccumFinalTotalNumberOfItemsSoldThisWeekInteger As Integer
' FINAL CALCULATIONS AT EOF:
Private FinalProfitRatioDecimnal As Decimal
Private FinalAverageMarkupDecimal As Decimal
' PAGINATION CODE:
Private PageSizeInteger As Integer = 15
Private LineCounterInteger As Integer = 99
Private PageNumberInteger As Integer = 1
Private RecordSelectedBoolean As Boolean
'--------------------------------------------------------------------------------------------------------------
Sub Main() ' PROGRAM STARTS HERE
Housekeeping()
Do While Not TURKEYSALESFILE.EndOfData
Call ProcessRecords()
Loop
Call EndOfJob() ' PROGRAM ENDS HERE AFTER LOOP. EOJ CHECKS FOR EOF STATUS. 1/1 = EOF
End Sub
'--------------------------------------------------------------------------------------------------------------
' LEVEL TWO PROCESSES
Private Sub Housekeeping()
SetFileDelimiter() ' SETS FILE TYPE AS DELIMITED AND ADDS A COMMA
End Sub
'--------------------------------------------------------------------------------------------------------------
Private Sub ProcessRecords()
ReadFile()
RecordSelection()
If RecordSelectedBoolean = True Then
DetailCalculations()
AccumulateTotals()
WriteDetailLine()
End If
'--------------------------------------------------------------------------------------------------------------
End Sub
Private Sub EndOfJob() ' PROGRAM END
FinalCalculations()
FinalOutput()
CloseFile()
End Sub
'--------------------------------------------------------------------------------------------------------------
Private Sub SetFileDelimiter()
TURKEYSALESFILE.TextFieldType = FileIO.FieldType.Delimited
TURKEYSALESFILE.SetDelimiters(",") ' ADDS A COMMA
End Sub
'--------------------------------------------------------------------------------------------------------------
Private Sub ReadFile() ' READS EACH RECORD IN ORDER
'Try
' TURKEYSALESFILE 'Do something dangerous
'Catch ex As System.Exception 'catch any error
' 'Handle the error here
'End Try
'Try
'Catch
' Console.WriteLine("ERROR")
'End Try
CurrentRecord = TURKEYSALESFILE.ReadFields()
ProductNumberInteger = CurrentRecord(0)
ProductDescriptionString = CurrentRecord(1)
WholeSalePriceDecimal = CurrentRecord(2)
MarkupCodeInteger = CurrentRecord(3)
QuantitySoldInteger = CurrentRecord(4)
End Sub
'--------------------------------------------------------------------------------------------------------------
Private Sub RecordSelection()
If ProductNumberInteger = 100 - 300 Or ProductNumberInteger = 400 - 500 Or ProductNumberInteger = 600 - 700 Then
RecordSelectedBoolean = True
End If
End Sub
'--------------------------------------------------------------------------------------------------------------
Private Sub DetailCalculations() ' GENERATES CALCULATIONS THAT IS TO BE APPLIED TO THE DATA SPECIFIED
CalculatedMarkupAmountDecimal = WholeSalePriceDecimal * MarkupRateDecimal
CalculatedRetailPriceDecimal = WholeSalePriceDecimal + CalculatedMarkupAmountDecimal
CalculatedDiscountAmountDecimal = CalculatedRetailPriceDecimal * DiscountPercentRateDecimal
CalculatedDiscountedPriceDecimal = CalculatedRetailPriceDecimal - CalculatedDiscountAmountDecimal
CalculatedTotalEarnedDecimal = CalculatedDiscountedPriceDecimal * QuantitySoldInteger
CalculatedTotalProfitDecimal = CalculatedTotalEarnedDecimal - (QuantitySoldInteger * WholeSalePriceDecimal)
End Sub
'--------------------------------------------------------------------------------------------------------------
Private Sub DetermineMarkupCode()
Select Case MarkupCodeInteger
Case Is = 1
MarkupCodeInteger = MARKUP_CODE_1_DECIMAL
Case = 2
MarkupCodeInteger = MARKUP_CODE_2_DECIMAL
Case = 3
MarkupCodeInteger = MARKUP_CODE_3_DECIMAL
Case = 4
MarkupCodeInteger = MARKUP_CODE_4_DECIMAL
Case Else
MarkupCodeInteger = MARKUP_CODE_5_DECIMAL
End Select
End Sub
'--------------------------------------------------------------------------------------------------------------
Private Sub DetermineDiscountAmount()
If QuantitySoldInteger = 0 - 10 Then
DiscountPercentRateDecimal = 1.0
Else
If QuantitySoldInteger = 11 - 25 Then
DiscountPercentRateDecimal = 10.0
Else
If QuantitySoldInteger = 26 - 40 Then
DiscountPercentRateDecimal = 12.5
Else
If QuantitySoldInteger = 41 - 50 Then
DiscountPercentRateDecimal = 20.0
Else
DiscountPercentRateDecimal = 25.5
End If
End If
End If
End If
End Sub
'--------------------------------------------------------------------------------------------------------------
Private Sub AccumulateTotals()
AccumFinalTotalWholesalePriceDecimal += WholeSalePriceDecimal
AccumFinalTotalMArkupAmountDecimal += CalculatedMarkupAmountDecimal
AccumFinalTotalProfitDecimal += CalculatedTotalProfitDecimal
AccumFinalTotalNumberOfItemsSoldThisWeekInteger += 1
End Sub
'--------------------------------------------------------------------------------------------------------------
Private Sub WriteDetailLine()
If LineCounterInteger > PageSizeInteger Then
WriteHeaders()
End If
' DETAIL LINE OUTPUT
Console.WriteLine(ProductNumberInteger.ToString().PadRight(3) &
Space(1) & ProductDescriptionString.PadLeft(12) &
Space(1) & WholeSalePriceDecimal.ToString("N").PadLeft(5) &
Space(2) & MarkupCodeInteger.ToString() &
Space(1) & CalculatedMarkupAmountDecimal.ToString("N").PadLeft(5) &
Space(2) & CalculatedRetailPriceDecimal.ToString("N").PadLeft(6) &
Space(1) & DiscountPercentRateDecimal.ToString("n0") &
Space(1) & CalculatedDiscountAmountDecimal.ToString("N").PadLeft(5) &
Space(2) & QuantitySoldInteger.ToString().PadLeft(2) &
Space(2) & CalculatedDiscountedPriceDecimal.ToString("N").PadLeft(6) &
Space(1) & CalculatedTotalEarnedDecimal.ToString("N").PadLeft(8) &
Space(2) & CalculatedTotalProfitDecimal.ToString("N").PadLeft(6))
LineCounterInteger += 1
End Sub
'--------------------------------------------------------------------------------------------------------------
Private Sub WriteHeaders()
Console.WriteLine("Page" & PageNumberInteger.ToString("n0").PadLeft(3) &
Space(18) & "Sales and Profit Report for")
Console.WriteLine(Space(25) & "Thanks for Thanksgiving, Inc.,")
Console.WriteLine(Space(32) & "by Nathaniel Kulinski")
Console.WriteLine()
Console.WriteLine("Item Desc" &
Space(6) & "WhlSale" &
Space(1) & "-Markup-" &
Space(2) & "Retail" &
Space(1) & "-Discount-" &
Space(1) & "Qty" &
Space(2) & "Discnt" &
Space(4) & "Total")
Console.WriteLine("Num" &
Space(14) & "Price" &
Space(1) & "Code" &
Space(1) & "Amt" &
Space(2) & "Price" &
Space(5) & "%" &
Space(3) & "Amt" &
Space(1) & "Sld" &
Space(3) & "Price" &
Space(3) & "Earned" &
Space(2) & "Profit")
Console.WriteLine()
LineCounterInteger = 1
PageNumberInteger += 1
End Sub
'--------------------------------------------------------------------------------------------------------------
Private Sub FinalCalculations()
FinalProfitRatioDecimnal = AccumFinalTotalProfitDecimal / AccumFinalTotalWholesalePriceDecimal
FinalAverageMarkupDecimal = AccumFinalTotalMarkupAmountDecimal / AccumFinalTotalNumberOfItemsSoldThisWeekInteger
End Sub
Private Sub FinalOutput()
Console.WriteLine()
Console.WriteLine(Space(1) & "FINAL TOTALS:")
Console.WriteLine(Space(5) & "Wholesale Price" &
Space(6) & AccumFinalTotalWholesalePriceDecimal.ToString("C").PadLeft(9))
Console.WriteLine(Space(5) & "Markup Amount" &
Space(8) & AccumFinalTotalMarkupAmountDecimal.ToString("C").PadLeft(9))
Console.WriteLine(Space(5) & "Profit" &
Space(15) & AccumFinalTotalProfitDecimal.ToString("C").PadLeft(9))
Console.WriteLine(Space(5) & "Items Sold" &
Space(12) & AccumFinalTotalNumberOfItemsSoldThisWeekInteger.ToString("N").PadLeft(5))
Console.WriteLine()
Console.WriteLine(Space(5) & "Profit Ratio" &
Space(11) & FinalProfitRatioDecimnal.ToString("C").PadLeft(7))
Console.WriteLine(Space(5) & "Avg Markup Per Item" &
Space(5) & FinalAverageMarkupDecimal.ToString("C").PadLeft(6))
End Sub
Private Sub CloseFile() ' END OF PROGRAM
Console.WriteLine()
Console.WriteLine()
Console.WriteLine()
Console.WriteLine("Press Enter To Close Window") ' PROMPT FOR THE USER TO CLOSE THE PROGRAM
Console.ReadLine()
TURKEYSALESFILE.Close()
End Sub
End Module
我在多个地方尝试过该剧本无济于事。这是使用布局,标准脚本正在布局中呈现。