Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / February 2006

Tip: Looking for answers? Try searching our database.

Late binding equivalent

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John - 24 Feb 2006 01:34 GMT
Hi

What is the late binding equivalent of the below code?

Many Thanks

Regards

   Dim O As Outlook.Application
   Dim F As Outlook.MAPIFolder
   Dim iCon As Outlook.ContactItem
   Dim oContact As Outlook.ContactItem

    O = New Outlook.Application

    F =
O.Session.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderContacts)
    oContact = DirectCast(F.Items.Item(1), Outlook.ContactItem)
    oContact.Delete()

    iCon = CType(F.Items().Add(Outlook.OlItemType.olContactItem),
Outlook.ContactItem)
    F.Items().Add(Outlook.OlItemType.olContactItem)

CMM - 24 Feb 2006 02:55 GMT
Everything stays the same except:

1) All your "As xxxx" change to "As Object"
2) o = New Outlook.Application changes to o =
CreateObject("Outlook.Application")

And you get rid of the direct casts (since you can't cast to an object time
you don't know about).

Oh yeah, and Option Strict Off needs to be at the top of the module, I'm
pretty sure.

Signature

-C. Moya
www.cmoya.com

> Hi
>
[quoted text clipped - 19 lines]
> Outlook.ContactItem)
>     F.Items().Add(Outlook.OlItemType.olContactItem)
John - 24 Feb 2006 03:12 GMT
Getting error on Outlook.ContactItem on line below. How do I deal with this?

iCon = CType(F.Items().Add(2), Outlook.ContactItem)

Thanks

Regards

> Everything stays the same except:
>
[quoted text clipped - 31 lines]
>> Outlook.ContactItem)
>>     F.Items().Add(Outlook.OlItemType.olContactItem)
CMM - 24 Feb 2006 04:11 GMT
Sheesh. If the starting point I gave couldn't get you started, you really
shouldn't be programming. I mean, seriously...it seems that some really
really BASIC concepts are eluding you. You're basically looking for someone
to do it *for you*

Why are using CType? Do you know what it does? Stop trying to "cast." Same
goes for the constant "olContactItem." Find out what integer this represents
(um, research... use your wits) and use that in the place of the constant.

Signature

-C. Moya
www.cmoya.com

John - 25 Feb 2006 00:48 GMT
Actually I have already done it after your first post but before the second
post and just wanted to double check the small point. As you can see I had
already determined and used the constant. Thanks for the original post that
helped me to complete this successfully.

Regards

> Sheesh. If the starting point I gave couldn't get you started, you really
> shouldn't be programming. I mean, seriously...it seems that some really
[quoted text clipped - 5 lines]
> represents (um, research... use your wits) and use that in the place of
> the constant.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.