Directory Programming .NET

Active Directory and ADAM programming support for .NET developers
Welcome to Directory Programming .NET Sign in | Join | Help

VB.NET Converted Book Listings

File Details
Downloads: 11899 File Size: 50.3kB
Posted By: joe Views: 8959
Date Added: Sat, Jul 15 2006

These listing show the code samples from the book as printed with minor corrections put in place.  In places where expanded samples are alluded to, those will come from the upcoming conversion of the "full listings" that Ryan rewrote for the website exclusively.  We did not attempt to merge those into these samples yet.  Sorry. 

In most cases in the book, we used the VB.NET "Using" statement to substitute for the C# "using" statement.  This means that the sample as shown will not compile in VB.NET 1.x, as the Using statement is new to .NET 2.0.  Sorry about that too.  It was too awkward to rewrite the ones that would otherwise work the same in .NET 1.x with the 1.x syntax.  If you need to do that, replace:

Using (xxx)

End Using

...with this:

Try
xxxx

Finally
    If Not (xxxx Is Nothing) AndAlso TypeOf(xxxx) Is IDisposable Then
        Dim id As IDisposable = DirectCast(xxxx, IDisposable)
        xxxx.Dispose()
    End If
End Try

In some cases, C# using statements were refactored to as the usage restrictions in VB.NET for inline declarations are more restrictive. 

I checked the vast majority of the samples to see if they would compile when put in a valid code block, but did not check them for functionality.  They should work as well as the C# ones do.

All feedback on these and other topics should go to the website forums.

Thanks!

Joe

Comments
 

seidensc said:

Hi Joe, Thanks for providing this information. Some of our older directory programs are VB.Net. The information you provided is very helpful when we need to add functionality. Steve
Fri, Jan 16 2009 8:34 AM
 

dp said:

Hi Joe. Question on the Try..Finally code sample for .NET 1.x. If you are doing Dim id As IDisposable = DirectCast(xxxx, IDisposable) Shouldn't xxxx.Dispose() be id.Dispose() instead?
Mon, Aug 10 2009 11:26 AM
 

Suddenlink Communications said:

Thanks Joe!
Wed, Sep 30 2009 5:16 PM
 

Pettt[cz] said:

Any reason why Listing 5.5. is omitted in this conversion package...? Just what I need :O(
Mon, Mar 15 2010 4:45 PM
 

dakVaksdype said:

Hi Joe, Thanks for providing this information.
Wed, Oct 13 2010 5:41 AM
 

dakVaksdype said:

joe thanks......
Wed, Jan 19 2011 6:32 AM
 

GERTRUDEBO said:

thanks for the info
Sat, May 21 2011 12:13 AM

Add Comment

Add
Name
Web Site
Comment