This was a little trickier than expected but these two samples seem to work. The cancel and close buttons have a string value where as you have declared a double value. Sample 1 sends the string error to a double value which luckily you don't need to use a value of 0. Sample 2 handles the string values first then the double values.
Here is a link to sample1
Width :
On Error Resume Next
Dim dSheetWidth As Double = CInt(InputBox("Enter Material Width (Value Required)", "Sheet Width", 0.00))
On Error GoTo 0 'Error handling
If dSheetWidth = 0 Then GoTo Width
MessageBox.Show(dSheetWidth, "Success")
Here is a link to sample2
Width :
Dim dSheetWidth As Double
Dim sSheetWidth As String = InputBox("Enter Material Width (Value Required)", "Sheet Width", 0.00)
If sSheetWidth = vbNullString Then : GoTo Width 'Deal with cancel/close button
ElseIf sSheetWidth <> vbNullString And Not IsNumeric(sSheetWidth)Then : GoTo Width 'Deal with non numeric values
ElseIf sSheetWidth <> vbNullString And IsNumeric(sSheetWidth)Then 'Is a valid double entry
dSheetWidth = CInt(sSheetWidth)
If dSheetWidth = 0 Then : GoTo Width
Else
MessageBox.Show(dSheetWidth, "Success")
End If
End If
If this solved a problem, please click (accept) as solution.
Or if this helped you, please, click (like)
Regards
Alan