467,077 Members | 963 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

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

Converting C# to VB .NET

I'm converting some C# to VB .NET.

In an example that uses Outlook, I find the following C# statement:

Outlook.AppointmentItem appointment =
(Outlook.AppointmentItem)outlook.CreateItem(
Outlook.OlItemType.olAppointmentItem);

I do not understand how to convert the (Outlook.AppointmentIem) portion of
the statement.

--
http://www.standards.com/; See Howard Kaikow's web site.
Nov 21 '05 #1
  • viewed: 2594
Share:
5 Replies
Use CType

appointment =
CType(outlook.CreateItem(Outlook.OlItemType.olAppo intmentItem),
Outlook.AppointmentItem)

--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com
"Howard Kaikow" <ka****@standards.com> wrote in message
news:%2******************@TK2MSFTNGP14.phx.gbl...
I'm converting some C# to VB .NET.

In an example that uses Outlook, I find the following C# statement:

Outlook.AppointmentItem appointment =
(Outlook.AppointmentItem)outlook.CreateItem(
Outlook.OlItemType.olAppointmentItem);

I do not understand how to convert the (Outlook.AppointmentIem) portion of
the statement.

--
http://www.standards.com/; See Howard Kaikow's web site.

Nov 21 '05 #2
Thanx.

I thought that it had to be something like that.

--
http://www.standards.com/; See Howard Kaikow's web site.
"Manohar Kamath" <mk*****@TAKETHISOUTkamath.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Use CType

appointment =
CType(outlook.CreateItem(Outlook.OlItemType.olAppo intmentItem),
Outlook.AppointmentItem)

--
Manohar Kamath
Editor, .netWire
www.dotnetwire.com
"Howard Kaikow" <ka****@standards.com> wrote in message
news:%2******************@TK2MSFTNGP14.phx.gbl...
I'm converting some C# to VB .NET.

In an example that uses Outlook, I find the following C# statement:

Outlook.AppointmentItem appointment =
(Outlook.AppointmentItem)outlook.CreateItem(
Outlook.OlItemType.olAppointmentItem);

I do not understand how to convert the (Outlook.AppointmentIem) portion of the statement.

--
http://www.standards.com/; See Howard Kaikow's web site.


Nov 21 '05 #3
Howard:
Please feel free to download the Demo Edition of our Instant VB C# to VB.NET
converter at http://www.instantvb.com. The Demo Edition is very useful for
quickly converting small C# code snippets and it's fully supported.

Regards,
David Anton
Tangible Software Solutions Inc.
www.tangiblesoftwaresolutions.com
Home of the Instant VB C# to VB.NET converter and the Instant C# VB.NET to
C# converter

"Howard Kaikow" wrote:
I'm converting some C# to VB .NET.

In an example that uses Outlook, I find the following C# statement:

Outlook.AppointmentItem appointment =
(Outlook.AppointmentItem)outlook.CreateItem(
Outlook.OlItemType.olAppointmentItem);

I do not understand how to convert the (Outlook.AppointmentIem) portion of
the statement.

--
http://www.standards.com/; See Howard Kaikow's web site.

Nov 21 '05 #4
Howard,

"Howard Kaikow" <ka****@standards.com> schrieb:
I'm converting some C# to VB .NET.

In an example that uses Outlook, I find the following C# statement:

Outlook.AppointmentItem appointment =
(Outlook.AppointmentItem)outlook.CreateItem(
Outlook.OlItemType.olAppointmentItem);

I do not understand how to convert the (Outlook.AppointmentIem) portion of
the statement.


'(Outlook.AppointmentItem)' is a type cast.

\\\
Dim Appointment As Outlook.AppointmentItem = _
DirectCast( _
outlook.CreateItem(Outlook.OlItemType.olAppointmen tItem), _
Outlook.AppointmentItem _
)
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #5
Thanks to those who responded.

I have two books that compare VB .NET and C#.

The one from O'Reilly loses much of its value as there is no index!

The one from APress has an inadequate index. For example, neither Ctype nor
DirectCast is listed in the index, however, if one knows that a conversion
function is required, there is an index item for conversion functions. So if
one already knows the language from which one is translating, the book could
be useful.

I guess one has to fully read such books, but as a reference, they are
inadequate.

--
http://www.standards.com/; See Howard Kaikow's web site.
"Howard Kaikow" <ka****@standards.com> wrote in message
news:%2******************@TK2MSFTNGP14.phx.gbl...
I'm converting some C# to VB .NET.

In an example that uses Outlook, I find the following C# statement:

Outlook.AppointmentItem appointment =
(Outlook.AppointmentItem)outlook.CreateItem(
Outlook.OlItemType.olAppointmentItem);

I do not understand how to convert the (Outlook.AppointmentIem) portion of
the statement.

--
http://www.standards.com/; See Howard Kaikow's web site.

Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by mustafa | last post: by
8 posts views Thread by prabha | last post: by
2 posts views Thread by Map Reader | last post: by
12 posts views Thread by Frederik Vanderhaeghe | last post: by
7 posts views Thread by Tor Aadnevik | last post: by
4 posts views Thread by gg9h0st | last post: by
2 posts views Thread by shenanwei@gmail.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.