Below is an small piece of the code for a project of mine. It is the first calculation in the code that sets up the entire calculation and if the data in one of two text boxes happens to not be entered then I want it to throw a warning using a MessageBox.
Now I accomplish that event but I would like it to stop the calculation and place the curser within the text box that data input is missing once "OK" is clicked on the message box. Then once that data is added, the user can then hit the "Total_Click" button to start the calculation over again.
Right now it throws the event, but once you hit "OK" then it continues the calculation. (Which throws an exception because this beginning data input is missing)
Hope that makes sense. Thanks in advance!
Private Sub Total_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Total.Click
'All the following CALCULATES when the "Risk/Reward" button is clicked.
'The following calculates the total dollar share amount.
If Not String.IsNullOrEmpty(_SharesTextBox.Text) And Not String.IsNullOrEmpty(EntryTextBox.Text) Then
TotalDollarShareAmount.Text = Format(Math.Round(CType(EntryTextBox.Text, Double) * CType(_SharesTextBox.Text, Double), 2), "#,###,###.00")
Dim iResponce As Integer
iResponce = MsgBox("Field is empty")