I need to check whether the two textboxes textbox_price and textbox_quantity contain numeric values or no values at all and if, give out the specific error message. textbox_item is only allowed non-numeric characters. Currently using the below concatenation of OR and it works, but I was wondering whether this was efficient and good. As you can see the check is long and difficult to read. Help appreciated.
If textbox_item.Text = "" Or textbox_price.Text = "" Or textbox_quantity.Text = "" Or IsNumeric(textbox_price.Text) = False Or IsNumeric(textbox_quantity.Text) = False Or IsNumeric(textbox_item.Text) = True Then
MsgBox("Please fill out every textbox with valid data", MsgBoxStyle.Information, "Invalid entry")
textbox_price.Text = ""
textbox_item.Text = ""
textbox_quantity.Text = ""
Exit Sub
End If
I would prefer to see a long If..Then..ElseIf chain, so the error message can be specific to the problem.