I have an If statement that checks the number of things (BaySlots () is an array of strings).
If (Not BaySlots.Contains(Not String.Empty)) OrElse (Not BayAcId = 0 AndAlso Not BayAcId = acProgramId _ AndAlso overrideSetting = False) Then
I, although the Array.Contains
method for the first condition would be sufficient to tell me whether the array contains only empty strings, but it gives an InvalidCastException: Conversion from string "" to type Long is not valid
, so I assume Not String.Empty
actually calculated on what it is trying to convert to long.
Is there a better way I can use to retro-fit this If so that I can enable the test only for empty rows in the array, as part of If, instead of adding a previous loop to test each BaySlots () index for an empty string?
I thought that there probably should be some way to check this, apart from the loop, as it will be a relative amount of work to check if there was any content.
thanks
PS just to clarify this, not to check if the array has zero dimensions or is Nothing, but all the lines that it contains are equal to String.Empty.
Toby source share