Hi,
My Environment is Windows 7, 3rd party VBScript Engine and MS Forms.
I'm doing "isnumeric" checks on a load of values in textboxes and listviews before doing a "CInt" on each of them.
What's the most compact way of doing this.
I started off like this:
and moved onto this until I realised it would display an error, but then move on the next textbox:
I could set an error flag in the sub and check it after every time I call subAddNumberToLV, but then it makes the code very bulky.
I don't have a controls container which I could loop through.
I did raise an error in the sub, but that stopped the code completely and closed the form which means the user would need to type everything in again.
Any thoughts?
Thanks
Kristian
My Environment is Windows 7, 3rd party VBScript Engine and MS Forms.
I'm doing "isnumeric" checks on a load of values in textboxes and listviews before doing a "CInt" on each of them.
What's the most compact way of doing this.
I started off like this:
Code:
if IsNumeric(txtPositionsTakenAtTemperature.Text) then
singPositionsTakenAtTemperature = CSng(txtPositionsTakenAtTemperature.Text)
else
msgbox("'Sample Positions taken at' is blank or is not a number")
exit sub
end ifand moved onto this until I realised it would display an error, but then move on the next textbox:
Code:
subAddNumberToLV alCalibrationTemperatures, txtCalibrateTempStart
subAddNumberToLV alCalibrationX, txtCalibrateX
subAddNumberToLV alCalibrationY, txtCalibrateYCode:
sub subAddNumberToLV( ByRef lvListView, ByRef strItem)
if IsNumeric(strItem) then
lvListView.Add(CSng(strItem))
else
msgbox(strItem & " is not a number")
exit sub
end if
End SubI don't have a controls container which I could loop through.
I did raise an error in the sub, but that stopped the code completely and closed the form which means the user would need to type everything in again.
Any thoughts?
Thanks
Kristian