G
Gary Simpson
Guest
I have a form where a user insert customers name and address, Then select a date, After selecting the date the user clicks a button to save the data to the database. Everything is fine up to now.
When I click another button to print out the information, How Do I use two message boxes, To check if the Price of Job has been inserted into the textbox (txtPriceOfJob), with the message box Yes/No, Asking if the user has forgotten to enter the price of the job. If the user select message box button Yes Then I the textbox is highlighted so they can put a price in the textbox (txtPriceOfJob).
If the user selects No from the message box, then Do nothing.
I then want to check if a price has been inserted into a Label (lbTotalPartsPrice) and If not, then a second message box saying.... Have you forgotten to enter a parts Price (Yes or No buttons).
If the user selects Yes then Highlight a textbox called (txtPartPrice1) so the user can insert the price of the part/s...
The issue I have is getting from the first message box to the second. The code I have now is below...
Private Sub CmdCreateInvoice_Click(sender As Object, e As EventArgs) Handles CmdCreateInvoice.Click
If GetDec((txtPriceOfJob.Text)) = GetDec("0.00") Then
Dim Message1 As String = "Have you forgotten to enter the Price of the job?"
Dim Caption1 As String = LbUsername.Text & ", There is no Price for Job"
Dim Buttons1 As MessageBoxButtons = MessageBoxButtons.YesNo
Dim Result1 As DialogResult
'Displays the MessageBox
Result1 = MessageBox.Show(Message1, Caption1, Buttons1)
' Gets the result of the MessageBox display.
If Result1 = System.Windows.Forms.DialogResult.Yes Then
' Go to TxtPartPrice1
CmdUpdate.PerformClick()
txtPriceOfJob.Focus()
ElseIf Result1 = System.Windows.Forms.DialogResult.No Then
'Go to the next else
End If
End If
'<<<<<<<<<<<<<<<<<<< Here is where my issue is >>>>>>>>>>>>>>
ElseIf GetDec(lbTotalPartsPrice.Text) = GetDec("0.00") Then
' Initializes variables to pass to the MessageBox.Show method.
Dim Message As String = "Have you forgotten to enter the Price of Parts?" & vbCrLf &
vbCrLf & "Click Yes to Add Price of Parts," &
vbCrLf & "Once Prices are Added, 'Click Save Update Button' " &
vbCrLf & vbCrLf & "Else" &
vbCrLf & vbCrLf & "Click No to Produce an Invoice without Part Prices"
Dim Caption As String = LbUsername.Text & ", No Price's have been Added for Parts"
Dim Buttons As MessageBoxButtons = MessageBoxButtons.YesNo
Dim Result As DialogResult
'Displays the MessageBox
Result = MessageBox.Show(Message, Caption, Buttons)
' Gets the result of the MessageBox display.
If Result = System.Windows.Forms.DialogResult.Yes Then
' Click CMDUpdate and Go to TxtPartPrice1
CmdUpdate.PerformClick()
txtPartPrice1.Focus()
ElseIf Result = System.Windows.Forms.DialogResult.No Then
'Go to next Else if
End If
If GetDec(lbTotalPartsPrice.Text) > GetDec("0.00") AndAlso GetDec((txtPriceOfJob.Text)) > GetDec("0.00") Then
UpdateJob2()
InsertIntoJobCompleted()
PrintDocument1.Print()
End If
End Sub
I hope someone can help
Kind Regards
Gary
Gary Simpson
Continue reading...
When I click another button to print out the information, How Do I use two message boxes, To check if the Price of Job has been inserted into the textbox (txtPriceOfJob), with the message box Yes/No, Asking if the user has forgotten to enter the price of the job. If the user select message box button Yes Then I the textbox is highlighted so they can put a price in the textbox (txtPriceOfJob).
If the user selects No from the message box, then Do nothing.
I then want to check if a price has been inserted into a Label (lbTotalPartsPrice) and If not, then a second message box saying.... Have you forgotten to enter a parts Price (Yes or No buttons).
If the user selects Yes then Highlight a textbox called (txtPartPrice1) so the user can insert the price of the part/s...
The issue I have is getting from the first message box to the second. The code I have now is below...
Private Sub CmdCreateInvoice_Click(sender As Object, e As EventArgs) Handles CmdCreateInvoice.Click
If GetDec((txtPriceOfJob.Text)) = GetDec("0.00") Then
Dim Message1 As String = "Have you forgotten to enter the Price of the job?"
Dim Caption1 As String = LbUsername.Text & ", There is no Price for Job"
Dim Buttons1 As MessageBoxButtons = MessageBoxButtons.YesNo
Dim Result1 As DialogResult
'Displays the MessageBox
Result1 = MessageBox.Show(Message1, Caption1, Buttons1)
' Gets the result of the MessageBox display.
If Result1 = System.Windows.Forms.DialogResult.Yes Then
' Go to TxtPartPrice1
CmdUpdate.PerformClick()
txtPriceOfJob.Focus()
ElseIf Result1 = System.Windows.Forms.DialogResult.No Then
'Go to the next else
End If
End If
'<<<<<<<<<<<<<<<<<<< Here is where my issue is >>>>>>>>>>>>>>
ElseIf GetDec(lbTotalPartsPrice.Text) = GetDec("0.00") Then
' Initializes variables to pass to the MessageBox.Show method.
Dim Message As String = "Have you forgotten to enter the Price of Parts?" & vbCrLf &
vbCrLf & "Click Yes to Add Price of Parts," &
vbCrLf & "Once Prices are Added, 'Click Save Update Button' " &
vbCrLf & vbCrLf & "Else" &
vbCrLf & vbCrLf & "Click No to Produce an Invoice without Part Prices"
Dim Caption As String = LbUsername.Text & ", No Price's have been Added for Parts"
Dim Buttons As MessageBoxButtons = MessageBoxButtons.YesNo
Dim Result As DialogResult
'Displays the MessageBox
Result = MessageBox.Show(Message, Caption, Buttons)
' Gets the result of the MessageBox display.
If Result = System.Windows.Forms.DialogResult.Yes Then
' Click CMDUpdate and Go to TxtPartPrice1
CmdUpdate.PerformClick()
txtPartPrice1.Focus()
ElseIf Result = System.Windows.Forms.DialogResult.No Then
'Go to next Else if
End If
If GetDec(lbTotalPartsPrice.Text) > GetDec("0.00") AndAlso GetDec((txtPriceOfJob.Text)) > GetDec("0.00") Then
UpdateJob2()
InsertIntoJobCompleted()
PrintDocument1.Print()
End If
End Sub
I hope someone can help
Kind Regards
Gary
Gary Simpson
Continue reading...