VB.Net Selecting Multiple Items in a Listbox

I was designing a form that would allow a user to select 1 or more items in one listbox and copy those items into a second listbox.  As I’m trying to figure out how to get the list of select item(s) in the first listbox,  I found a whole lot of suggestions, but nothing that really made sense.  It seems they want you to loop through a full list looking for the ones that are selected.

I came up with the following that creates a collection of selected records.  You then loop through that collection.

        Dim i As ListBox.SelectedIndexCollection
        i = ListBox1.SelectedIndices

        For Each a In i

The line in the middle of the For/Next loop is whatever you want to do with the selected records.

I hope this helps.

Posted in Uncategorized | Leave a comment

VB.Net 2010 – Creating an Installation Package

One of the things I hated about vb.Net is the “Click Once” installation.  It seems it only wants to install it on for the current user.  I’m an old fashioned kind of guy and wanted the old style installation that drops it in the program files directory.

This turned out to be pretty easy after Googling 50,000 different pages to find a decent answer.

Open your existing solution in VB.net.  Go to the file menu and click File->Add (don’t select new) and select “New Project”.

Expand “Other Project Types” and then expand “Visual Studio Installer”.  To the right of the templates select “Setup Wizard”, change the project’s name if you like and click OK.

Now the Setup Project Wizard will take over from here.

  1. Click “Next”
  2. Select “Create a setup for a Windows Application”.
  3. Click “Next”
  4. Select “Primary output from <project>”
  5. Click “Next”
  6. If you need to have it install other files like INI files, add them here.
  7. Click “Next”.
  8. Click “Finish”.

To actually build the installation package, you’ll see the setup project in the solution explorer.  Right-mouse click the new project and click “Build”.

Do to the directory where your VB projects are stored and open the one for the solution you’re working on.  You should see a folder there with the name of your installation package, open it.  Depending on whether you’re in debug or production mode, you’ll find the setup.exe and MSI pack in that folder.


Posted in Uncategorized | Leave a comment

Today’s task is to figure out how to deploy an application written in VB.Net 2010 without the ever annoying OnceClick.  All I really want to do is deploy it as an old fashioned Setup.exe.  Once I figure this out, I’ll post a follow up.

Posted in Uncategorized | Leave a comment

Hello world!

It’s time to actually start posting something here.   I’ve been thinking about do this for awhile as I started learning VB.Net.  There are so many posts out there with incorrect information that you spend hours trying to find something that would actually be helpful.

Posted in Uncategorized | 1 Comment