VB.net Code and Utilities
Resources for VB.NET Developers. Join our
VB.NET Mailing List to be notified of new additions to our library.
WSFile.zip (280K)
WSFile is a data transfer protocol that allows you asynchronously stream
large amounts of data from a system.io.stream to a web server via a web
service. The zip includes a web service project, a client-side component
project that implements the protocol, and a windows forms client that
demonstrates the protocol. It lets you upload a file to a web server
asynchronously, updating a progress bar after each "chunk" has been sent.
It also lets you pause and resume. Any stream can be used as the source
data.
Launcher.zip (84K)
So I was not satisfied with all of the options for auto-deploying .NET apps in version
1.1, and rather than waiting for ClickOnce, which only works in v2.0 anyway, I sat
down and designed and developed a simple and effective solution. Launcher is a VB.NET
project called you can copy to a new dev directory and modify for each application
you want to auto-deploy. Change four variables, rebuild, create a deployment project
for Launcher and distribute it.
When your user runs Launcher, everything happens automatically. Launcher prompts
the user for downloading a newer version if one is available, downloads, unzips,
and runs the app. If offline, Launcher simply runs the current version. The logic
here is easy to mofify to suit your needs. The zip file is downloaded in chunks
using the asynchronous model, and unzipped asynchronously as well.
Note that this application works well with small projects but not so well with large
projects. Because a new zip file is downloaded whenever there are any changes, if
the zip file is too large your user may get impatient. Also, make sure that your
application generates any settings files itself. That way, you don't run the risk
of overwriting your settings whenever you update the application.
FileMover.zip (78K)
A nice file copy and move component that copies and moves files asynchronously providing
a status event, so you can drive a ProgressBar or percent meter control. Since files
are copied asynchronously your user interface will continue to work while files
are being copied. This is also a great example of a component that uses the asynchronous
model and ISynchronizeInvoke to sync the UI.
SyncLockDemo.zip (27K)
A good demo in VB.NET 2003 illustrating the value of thread synchronization. It calls
a sub on three different threads simultaneously. The sub increments a counter in
a for/next loop. There are two versions, a raw unsynchronized version and a version
that calls SyncLock to synchronize access to the counter.
SelectForm.zip (55K)
This is a good example of visual inheritance. I created a new Windows form class
based on System.Windows.Forms.Form, and added the ability to let the user select
a rectangle ala rubberbanding. Set the AllowSelect property to True. When the user
selects a rectangle and releases the mouse, the RectangleSelected event is raised,
passing the rectangle relative to the form. A simple demo program (included) shows
how to use this form to let the user draw buttons. The buttons are named and wired
up to a Click event handler on the fly.
dpapiHelper.zip (167K)
If you went to DevDays 2004 then you know about DP-API. This is part of the CryptoAPI
that didn't make it into the .NET Framework. The nice folks at Vertigo Software
wrote a nifty VB.NET managed code wrapper around DPAPI because it's so dang hard
to use directly. They make it freakin easy to encrypt and decrypt strings without
having to manage keys.
I extracted the DPAPI class from IssueVision (the reference application Vertigo wrote
for Microsoft just for DevDays 2004) and turned it into a DLL assembly. Then I wrote
a test harness application that encrypts and decrypts a string in a text box. The
encrypted string is written to a file. I also used Matt Griffith's awesome .NET
Utilities DLL to do some hi-res timing on the code. Using this test harness I was
able to decrypt a 1.8MB string in about 365 ms on a 2.6GHz P4 with 1GB RAM. Not
bad.
DPAPI makes use of the user's credentials and an entropy (extra data you add to the
mix) to create the encrypted result and decrypt the ciphertext. Pretty slick. Anyway,
you can download the dpapi assembly and test harness pruned and ready to go right
here. Thanks Vertigo!
CarlsZipLibrary.zip (1.3M)
I have often used the awesome freeware ICSharpLib managed compression library but
I found myself doing the same thing with it all the time, which is to compress datasets,
collections, and arrays to and from byte arrays and streams. So, I wrote some generic
code to do this using the ICSharpLib compression dll.
ServerViewState.Zip (15K)
This is a DLL that you can use to persist __VIEWSTATE information in a Session variable
on the server. All you have to do is add a reference to it, and change your Inherits
(or extends in C#) statement. Readme file included. Thanks to Dino Esposito for
the original code, which this is borrowed from.
Bubbles.Zip (44K)
VB.NET Program for toddlers that draws filled shapes on the screen and plays notes
via MIDI when you move the mouse or tap the keyboard. Source included. Requires
Framework 1.1 Uses Carl Franklin's MIDI component (see below).
CarlsMIDITools.Zip
(135K)
Source and test harness for Carl Franklin's MIDI component. This is currently version
1.0, and the events have not yet been tested. However, it does play notes, change
patches, set volumes, and respond to controllers (i.e. output) very well!
MasterMind.Zip (15K)
My 7 year-old daughter, Emmy, and I love to play MasterMind. When I go away to conferences
or onsite classes, we miss playing before bed, so I am writing an Internet version
of MasterMind. So far I have coded the ability to play an opponent using the same
computer. This will evolve over time, but right now its a good example of how to
do some real graphics programming with GDI+ in VB.NET. - Carl Franklin
RemotingToolkit.Zip(3K)
A simple .NET Remoting configuration and VB.NET code demo with instructions for making
any .NET DLL remotable via IIS using a binary formatter, a best-practice in most
cases.
fnetschedule.Zip (874K)
Smart Device Application for the PocketPC written in VB.NET 2003 that accesses the
Franklins.Net Class schedule through our public web service, and lets the user scroll
through descriptions and dates, as well as a location picture. Referenced in MSDN
Magazine.
MailChecker.Zip (57K)
MailChecker is a DLL that lets you check the validity of an Email address by querying
the mail server responsible for the email address and asking it via SMTP if the
email is valid.
C# to VB.NET Converter
This is a website where you can paste in C# code and it spits out VB.NET code. Cool!
Detailed SQL Error Messages (8K)
Shows how to get rich displayable error messages when you catch a SQLException.
|