Why are you converting it to a string. Use
Code:
If(theIndex == CB_ERR)
//show error message