469,578 Members | 1,742 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,578 developers. It's quick & easy.

DirectCast

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.
Jan 10 '08 #1
9 5769
kimiraikkonen,

http://www.panopticoncentral.net/arc...07/10/149.aspx

Kerry Moorman

"kimiraikkonen" wrote:
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.
Jan 10 '08 #2
"kimiraikkonen" <ki*************@gmail.comschrieb
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

Jan 10 '08 #3
"kimiraikkonen" <ki*************@gmail.comschrieb
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

Jan 10 '08 #4
On Jan 11, 1:41*am, Kerry Moorman
<KerryMoor...@discussions.microsoft.comwrote:
kimiraikkonen,

http://www.panopticoncentral.net/arc...07/10/149.aspx

Kerry Moorman

"kimiraikkonen" wrote:
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.- Hide quoted text -

- Show quoted text -
Thanks for the link. I'll take a look.

and

thanks Armin for the explanation.
Jan 10 '08 #5
On Jan 11, 1:47*am, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On Jan 11, 1:41*am, Kerry Moorman

<KerryMoor...@discussions.microsoft.comwrote:
kimiraikkonen,
http://www.panopticoncentral.net/arc...07/10/149.aspx
Kerry Moorman
"kimiraikkonen" wrote:
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.- Hide quoted text -
- Show quoted text -

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 :-)
Jan 11 '08 #6
Yet another good reason for NOT using a web-based 'portal' for accessing
usenet newsgroups.
"kimiraikkonen" <ki*************@gmail.comwrote in message
news:e0**********************************@c23g2000 hsa.googlegroups.com...
On Jan 11, 1:47 am, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On Jan 11, 1:41 am, Kerry Moorman

<KerryMoor...@discussions.microsoft.comwrote:
kimiraikkonen,
http://www.panopticoncentral.net/arc...07/10/149.aspx
Kerry Moorman
"kimiraikkonen" wrote:
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.- Hide quoted text -
- Show quoted text -

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 :-)

Jan 11 '08 #7
On Jan 11, 9:33 pm, "Stephany Young" <noone@localhostwrote:
Yet another good reason for NOT using a web-based 'portal' for accessing
usenet newsgroups.

"kimiraikkonen" <kimiraikkone...@gmail.comwrote in message

news:e0**********************************@c23g2000 hsa.googlegroups.com...
On Jan 11, 1:47 am, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On Jan 11, 1:41 am, Kerry Moorman
<KerryMoor...@discussions.microsoft.comwrote:
kimiraikkonen,
>http://www.panopticoncentral.net/arc...07/10/149.aspx
Kerry Moorman
"kimiraikkonen" wrote:
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.- Hide quoted text -
- Show quoted text -
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 :-)
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.
Jan 11 '08 #8
On 2008-01-11, kimiraikkonen <ki*************@gmail.comwrote:
On Jan 11, 9:33 pm, "Stephany Young" <noone@localhostwrote:
>Yet another good reason for NOT using a web-based 'portal' for accessing
usenet newsgroups.

"kimiraikkonen" <kimiraikkone...@gmail.comwrote in message

news:e0**********************************@c23g200 0hsa.googlegroups.com...
On Jan 11, 1:47 am, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On Jan 11, 1:41 am, Kerry Moorman
<KerryMoor...@discussions.microsoft.comwrote:
kimiraikkonen,
>http://www.panopticoncentral.net/arc...07/10/149.aspx
Kerry Moorman
"kimiraikkonen" wrote:
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.- Hide quoted text -
- Show quoted text -
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 :-)

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 :)

--
Tom Shelton
Jan 11 '08 #9
On Fri, 11 Jan 2008 11:52:50 -0800 (PST), kimiraikkonen
<ki*************@gmail.comwrote:
>On Jan 11, 9:33 pm, "Stephany Young" <noone@localhostwrote:
>Yet another good reason for NOT using a web-based 'portal' for accessing
usenet newsgroups.

"kimiraikkonen" <kimiraikkone...@gmail.comwrote in message

news:e0**********************************@c23g200 0hsa.googlegroups.com...
On Jan 11, 1:47 am, kimiraikkonen <kimiraikkone...@gmail.comwrote:
On Jan 11, 1:41 am, Kerry Moorman
<KerryMoor...@discussions.microsoft.comwrote:
kimiraikkonen,
>http://www.panopticoncentral.net/arc...07/10/149.aspx
Kerry Moorman
"kimiraikkonen" wrote:
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.- Hide quoted text -
- Show quoted text -
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 :-)

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.
I use Agent. <http://www.forteinc.com/main/homepage.php>
Jan 11 '08 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

10 posts views Thread by Sahil Malik | last post: by
11 posts views Thread by Tubs | last post: by
13 posts views Thread by Crirus | last post: by
6 posts views Thread by Ot | last post: by
6 posts views Thread by Mark Nethercott | last post: by
7 posts views Thread by Brian Henry | last post: by
1 post views Thread by iwdu15 | last post: by
3 posts views Thread by =?Utf-8?B?TWlrZQ==?= | last post: by
reply views Thread by suresh191 | last post: by
4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.