點擊後檢查的「機構必須數」結果「選擇媒體和預估基金。」然後從左邊的代理列表框中選擇該機構的名稱並單擊「添加代理商」。單擊「添加代理商:」按鈕後,所選代理商的名稱應顯示在代理列表旁邊的列表框中的 。以下是機構列表,應在左邊的機構列表框中輸入。需要幫助,我在Visual Basic數組,不添加正確
U-Ad 350美元Striker 190美元NewAd 250美元Samson 530美元J & R 420美元Victory 120美元。
單擊「添加代理商」按鈕時,計算出的估算成本結果應顯示在「總估計成本」旁邊的文本框中。 例如,如果您選擇了「U-Ad」和「Samson 「,那麼總的估計成本將是$ 880.00;單擊「添加代理商」時應顯示結果:添加更多代理商時,應更新此類計算的估算成本。
Public Class Form1
Private Sub btnMediaEstimatedFund_Click(sender As Object, e As EventArgs) Handles btnMediaEstimatedFund.Click
Dim interestRate, balance, initialBalance As Double
txtBoxEstimatedBudget.Enabled = False
txtBoxAgenciesNeeded.Enabled = False
If radButtonTraditional.Checked Then
txtBoxAgenciesNeeded.Text = 3
ElseIf radButtonEMedia.Checked Then
txtBoxAgenciesNeeded.Text = 2
End If
If checkBoxSavings.Checked Then
interestRate = 0.07
ElseIf checkBoxCorporate.Checked Then
interestRate = 0.05
ElseIf checkBoxCorporate.Checked And checkBoxSavings.Checked Then
interestRate = 0.05 * 0.07
End If
initialBalance = InputBox("Please Enter a balance between $500.00 and $3000.00")
If initialBalance > 3000 Then
InputBox("Please enter a number equal to or below $3000.00 and no less than $500.00")
ElseIf initialBalance < 500 Then
InputBox("Please enter a number equal to or above $500.00 and no more than $3000.00")
Else
balance = initialBalance * (1 + interestRate)
txtBoxEstimatedBudget.Text = balance
End If
End Sub
Private Sub btnAddAgencies_Click(sender As Object, e As EventArgs) Handles btnAddAgencies.Click
Dim dict As Dictionary(Of String, Integer) = New Dictionary(Of String, Integer)()
dict.Add("U-Ad", 350)
dict.Add("Striker", 190)
dict.Add("New Ad", 250)
dict.Add("Samson", 530)
dict.Add("J & R", 420)
dict.Add("Victory", 120)
Dim selectedItems = (From i In lstBoxAgenciesList.SelectedItems).ToArray()
Dim total As Integer = 0
For Each selectedItem In selectedItems
lstBoxSelectedList.Items.Add(selectedItem)
lstBoxAgenciesList.Items.Remove(selectedItem)
total += dict(selectedItem)
Next
txtBoxEstimatedCost.Text = total.ToString()
End Sub
Private Sub btnGenerateReport_Click(sender As Object, e As EventArgs) Handles btnGenerateReport.Click
Dim employeeLevel, year, selectedMedia, numberOfAgencies As String
Dim today As Date
today = CStr(dtpToday.Text)
Name = CStr(txtBoxCreator.Text)
employeeLevel = CStr(lstBoxResults.Text)
year = CStr(lstBoxResults.Text)
selectedMedia = CStr(lstBoxResults.Text)
numberOfAgencies = CStr(txtBoxAgenciesNeeded.Text)
dtpToday.Text = FormatDateTime(today, DateFormat.ShortDate)
If radButtonManager.Checked Then
employeeLevel = "Manager"
ElseIf radButtonStaff.Checked Then
employeeLevel = "Staff"
End If
If radButton2015.Checked Then
year = "2015"
ElseIf radButton2016.Checked Then
year = "2016"
ElseIf radButton2017.Checked Then
year = "2017"
End If
If radButtonTraditional.Checked Then
selectedMedia = "Traditional Media (TV, Radio)"
ElseIf radButtonEMedia.Checked Then
selectedMedia = "New e-Media (SNS, e-Mail)"
End If
lstBoxResults.Items.Add("=======================================")
lstBoxResults.Items.Add(" ")
lstBoxResults.Items.Add("Date : " & today)
lstBoxResults.Items.Add(" ")
lstBoxResults.Items.Add("Reporting Entity : " & Name)
lstBoxResults.Items.Add(" ")
lstBoxResults.Items.Add("Level of Employee : " & employeeLevel)
lstBoxResults.Items.Add(" ")
lstBoxResults.Items.Add("=======================================")
lstBoxResults.Items.Add(" ")
lstBoxResults.Items.Add("Year" & " " & year & " " & "Budget of Advertising Report")
lstBoxResults.Items.Add(" ")
lstBoxResults.Items.Add("=======================================")
lstBoxResults.Items.Add(" ")
lstBoxResults.Items.Add("Total Estimated Cost : " & FormatCurrency(txtBoxEstimatedCost.Text))
lstBoxResults.Items.Add(" ")
lstBoxResults.Items.Add("Total Estimated Budget : " & FormatCurrency(txtBoxEstimatedBudget.Text))
lstBoxResults.Items.Add(" ")
lstBoxResults.Items.Add("Selected Media : " & selectedMedia)
lstBoxResults.Items.Add(" ")
lstBoxResults.Items.Add("Number of Agencies Involved : " & numberOfAgencies)
lstBoxResults.Items.Add(" ")
lstBoxResults.Items.Add("=======================================")
End Sub
末級
修改過的代碼!
當您有解決方案時,請不要刪除您的問題的文本。你的問題文本將有助於未來的訪問者有同樣的問題。這是Stack Overflow的目的。謝謝! – 2013-03-24 01:17:42