DirectCast

K

kimiraikkonen

Hi,
I'm trying to learn the function of DirectCast and CType which are
similiar. Could you explain and sample a simple code that shows what
they exactly do and have differences?

Thanks.
 
A

Armin Zingler

kimiraikkonen said:
Hi,
I'm trying to learn the function of DirectCast and CType which are
similiar. Could you explain and sample a simple code that shows what
they exactly do and have differences?

DirectCast /only/ does type casting. Casting does not create a new
object, it just changes the type of the reference. This implicitly means
that the object must be of the destination type, derived from the
destination type or implement the destination interface.

CType either converts or casts. If it can not be casted, VB will try to
convert the source object to a new destination object. CType will be
compiled to whatever is necessary in the specific situation, depending
on the type of the source object and the destination type. In addition,
CType can be defined as a user defined operators.

For details please have a look at "Type Conversions in Visual Basic".
Too much to paste here.


Armin
 
A

Armin Zingler

kimiraikkonen said:
Hi,
I'm trying to learn the function of DirectCast and CType which are
similiar. Could you explain and sample a simple code that shows what
they exactly do and have differences?

DirectCast /only/ does type casting. Casting does not create a new
object, it just changes the type of the reference. This implicitly means
that the object must be of the destination type, derived from the
destination type or implement the destination interface.

CType either converts or casts. If it can not be casted, VB will try to
convert the source object to a new destination object. CType will be
compiled to whatever is necessary in the specific situation, depending
on the type of the source object and the destination type. In addition,
CType can be defined as a user defined operators.

For details please have a look at "Type Conversions in Visual Basic".
Too much to paste here.

[sorry, no example] ;)


Armin
 
K

kimiraikkonen

Thanks for the link. I'll take a look.

and

thanks Armin for the explanation.- Hide quoted text -

- Show quoted text -

Meanwhile, it seems my first(main) message is not shown on Google
group page for a reason related to Google servers.(interesting).
Kerry's message is shown as first message :)
 
S

Stephany Young

Yet another good reason for NOT using a web-based 'portal' for accessing
usenet newsgroups.


Thanks for the link. I'll take a look.

and

thanks Armin for the explanation.- Hide quoted text -

- Show quoted text -

Meanwhile, it seems my first(main) message is not shown on Google
group page for a reason related to Google servers.(interesting).
Kerry's message is shown as first message :)
 
K

kimiraikkonen

Yet another good reason for NOT using a web-based 'portal' for accessing
usenet newsgroups.






Meanwhile, it seems my first(main) message is not shown on Google
group page for a reason related to Google servers.(interesting).
Kerry's message is shown as first message :)

Which software do you suggest? And also its settings?

I took a look on classic Outlook Express 6 which reads messages fine,
but the posting requires SMTP server configuration which i don't know
for newsgroups.
 
T

Tom Shelton

Which software do you suggest? And also its settings?

I took a look on classic Outlook Express 6 which reads messages fine,
but the posting requires SMTP server configuration which i don't know
for newsgroups.

slrn :)
 

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

Top