wrong cast ?

  • Thread starter Thread starter Sam
  • Start date Start date
S

Sam

Hi
I have a cast issue, I can't figure out why:

txtTabId.Text = DirectCast(Value, String)

Value is of type Integer and txtTabId.Text expects a String.

I get the error :

'DirectCast' operand must have a reference type, but 'Integer' is a
value type.
 
Sam said:
Hi
I have a cast issue, I can't figure out why:

txtTabId.Text = DirectCast(Value, String)

Value is of type Integer and txtTabId.Text expects a String.

I get the error :

'DirectCast' operand must have a reference type, but 'Integer' is a
value type.

What about txtTabID.text = Value.ToString() ?
 
Sam,

DirectCast is a cast
CType, Cstr, and ToString are conversions

VBNet is really strict in that.

Cor
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top