>>Hi everybody,
>>
>>Quite often I am getting an exception about Invalid format. Say, I just got one here
>>
>>
>>Byte instr_type = Convert.ToByte(GetParameterValue(rowValues, "instr_type"));
>>
>>The value is returned as empty string and apparently ToByte and other conversions can not deal with empty string. So, EVL function may be helpful here.
>>
>>Is there any way to write this expression to not get exception without doing this with extra variable first?
>>
>>Thanks in advance.
>
>Would Byte.TryParse work for you?
Yes, essentially this is what I used. We had methods already to return parameter value in needed format, but we didn't have GetParameterByte method. So, I went ahead and added it with TryParse.
If it's not broken, fix it until it is.
My Blog