需要一些帮助来完成这个程序,一切都像我想要的那样工作和运行,但我需要显示一个输入框,允许用户输入他们想要存储在 service_date 中的发票的日期,然后这个日期将显示在列表框中我放在那里的所有其他物品。我知道我需要使用 AddDays 功能,但我不知道如何使用它,并且在线研究让我发现了 100 件其他不是这样的事情。
所以这是我的代码:
Dim Customer As String
Dim Phone As String
Dim Hours As Double
Dim Parts As Double
Dim due_date As String
Dim service_date As String
Private Sub cmdInputBox_Click()
Dim service_date = InputBox("Enter the date of service. (MM/DD?YYYY)")
MsgBox("That's your date, " & service_date.ToString)
Exit Sub
End Sub
Private Sub CustInfo_Click()
Customer = txtCustomer.Text
Phone = mtbPhone.Text
Double.TryParse(txtHours.Text, Hours)
Double.TryParse(txtParts.Text, Parts)
If Customer.Length < 0 Then
MessageBox.Show("Please enter customer information.")
End If
If Phone = "" Then
MessageBox.Show("Please enter phone number.")
End If
If Not Double.TryParse(txtHours.Text, Hours) Then
MessageBox.Show("Please enter labor hours.")
End If
If Not Double.TryParse(txtParts.Text, Parts) Then
MessageBox.Show("Please enter parts and supplies.")
End If
''Perform calculations
Dim Total_Cost As Double
Dim Labor_Cost As Double
Dim Parts_Cost As Double
Parts_Cost = (Parts * 0.5 * 2)
Labor_Cost = (Hours * 35)
Total_Cost = (Hours + Parts)
Customer = txtCustomer.Text
Phone = mtbPhone.Text
lstBill.Items.Clear()
lstBill.Items.Add("Customer: " & vbTab & Customer.ToUpper)
lstBill.Items.Add("Phone: " & vbTab & vbTab & Phone)
lstBill.Items.Add("Service Date: " & vbTab & due_date)
lstBill.Items.Add("Invoice Date: " & vbTab & service_date)
lstBill.Items.Add("Labor Cost: " & vbTab & FormatCurrency(Labor_Cost))
lstBill.Items.Add("Parts Cost: " & vbTab & FormatCurrency(Parts_Cost))
lstBill.Items.Add("Total Cost: " & vbTab & FormatCurrency(Total_Cost))
Exit Sub
End Sub
Private Sub btnBill_Click(sender As System.Object, e As System.EventArgs) Handles btnBill.Click
cmdInputBox_Click()
CustInfo_Click()
End Sub