ict-torquilclark
asked on
Operation is not allowed in this context
Can anybody explain why I am getting the error in the title on the last lnie of the code below?
If datagridviewClients.Item(2 , x).Value.ToString.ToUpper. Contains(" HEATH") Then
Heath = True
Else
Heath = False
End If
If Heath = True Then
It has baffled me....
If datagridviewClients.Item(2
Heath = True
Else
Heath = False
End If
If Heath = True Then
It has baffled me....
ASKER
That is all the code that there is - apart from the "End If"
heath is just defined in the code abover as a boolean
Dim Heath as Boolean
The if then sets it to true or false
and then i get the error on the next if...
heath is just defined in the code abover as a boolean
Dim Heath as Boolean
The if then sets it to true or false
and then i get the error on the next if...
try this:
dim value as string
value = datagridviewClients.Item(2, x).Value.ToString()
If value.ToUpper().Contains("HEATH") Then
Heath = True
Else
Heath = False
End If
If Heath = True Then
ASKER
I still get the same error.
The code is fine at assigning the true/false value to Heath. The error comes when evaluating it for the "If Health = True" line.
The code is fine at assigning the true/false value to Heath. The error comes when evaluating it for the "If Health = True" line.
Do you have anything else in your program called 'Heath' like perhaps a procedure?
What exactly is the error message?
What exactly is the error message?
Doesn't solve the mystery, but you could just try
If Heath Then
If Heath Then
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If Heath = True Then (Then what??) this is a syntax error I assume
Simply change the variable "Heath" to "booHeath" in your routine and try it again. Then you can rule out most of the suggestions above.
can u post more code, like what Heat is? property?
did u implement asynchronous operations?