Hi, I was doing my exercise in VB.NET launguage. Have a problem in capturing the user response for a message dialog.
Following is the code:
If tradeInAllowanceValueDecimal = 0D Then
messageString = "Do you have any trading-in Allowance Value ?"
MessageBox.Show(messageString, "Trading-in allowance Amount: ", MessageBoxButtons.YesNo, _
MessageBoxIcon.Information)
EndIf
If whichButtonDialogResult = DialogResult.Yes Then
Call clearButton_Click(sender, e)
With tradeInallowanceTextBox
.SelectAll()
.Focus()
EndWith
EndIf
Also dimmed the variable whichButtonDialogResult as DialogResult Object.
Now the questions are
1) When the user is clicking yes when the message box appeared on the screen, the same is not getting transfered to DialogResult.yes.
Basically the 2nd If statement of checking the dialog result is never getting satisfying.
2) The above Big "IF" is inside the TRY CATCH block. If the user says "yes" I need to come out of this TRY CATCH block, rather just need to exit out of this event. what is the way for that.
I can't put another IF statement encircling the CATCH blocks, that is not getting accepted. I also can't put this dialog result before the TRY CATCH block, because this is not the first field on the screen, I can't check this first before checking the primary fields.
Could you please let me know the way for this.
Following is the code:
If tradeInAllowanceValueDecimal = 0D Then
messageString = "Do you have any trading-in Allowance Value ?"
MessageBox.Show(messageString, "Trading-in allowance Amount: ", MessageBoxButtons.YesNo, _
MessageBoxIcon.Information)
EndIf
If whichButtonDialogResult = DialogResult.Yes Then
Call clearButton_Click(sender, e)
With tradeInallowanceTextBox
.SelectAll()
.Focus()
EndWith
EndIf
Also dimmed the variable whichButtonDialogResult as DialogResult Object.
Now the questions are
1) When the user is clicking yes when the message box appeared on the screen, the same is not getting transfered to DialogResult.yes.
Basically the 2nd If statement of checking the dialog result is never getting satisfying.
2) The above Big "IF" is inside the TRY CATCH block. If the user says "yes" I need to come out of this TRY CATCH block, rather just need to exit out of this event. what is the way for that.
I can't put another IF statement encircling the CATCH blocks, that is not getting accepted. I also can't put this dialog result before the TRY CATCH block, because this is not the first field on the screen, I can't check this first before checking the primary fields.
Could you please let me know the way for this.