Visual Basic 2017 Code Samples

  1. Free Visual Basic Code Examples
  2. Visual Basic Sample Projects

A basic example of using Jason's MP3 Class Module to create an MP3 Player that uses the winmm.dll (Uses Api). This was made using Visual Basic 6.0, but should work with any 32 Bit Visual Basic. Download: MPlay3 hostyle Source code from mPlay3. Chilkat VB.NET Examples. Click on a category in the left rail to browse VB.NET examples.

Anybody who can master a telephone can certainly program.
Bob Frankston

Visual Basic 2017 Code Samples
Reference
notes
TutorialsAssignmentsDownloads
(inc. whole site)
Further
reading
Internet
resources

Sample visual basic program code
Reference Notes


Visual basic sample programs
Tutorials

Core Skills

  • Week 1 - Exploring the Visual Basic Environment
  • Week 2 - Understanding Events
  • Week 3 - Command Buttons, Option Buttons and Check Boxes
  • Week 4 - List Boxes and Combo Boxes
  • Week 5 - Menus and List manipulation
  • Week 6 - Creating and Using Arrays of Controls
  • Week 7 - Vertical & Horizontal Scroll Bars
  • Week 8 - Animation and Graphics
  • Week 9 - Working with Multiple Forms
  • Week 10 - Using the Grid Control
  • Week 11 - Working with Files
  • Week 12 - Working with Access 97 Databases

Advanced

  • Week 13 - Using Crystal Reports with VB
  • Week 14 - Multiple Document Interface (MDI)
  • Week 15 - Incorporating Sound
  • Week 16 - Creating a Windows Help file
  • Week 17 - The ActiveX Files

Assignments
  • HND2 - 1st Tutorial

Downloads

You are free to download these files and use them ‘as is’ or alter them in any way (copyright free). To use these files with Visual Basic 5.0 you should click on the appropriate file title, specify a file name in the dialog box that appears and then exit the web browser and unzip the file. If you do not have any decompression software then jump to www.winzip.com.

Free Visual Basic Code Examples

Visual Basic 5.0 Projects:

  • Access 97 Databases (22K)
    Writing a Visual Basic front-end to an Access 97 database.

  • ActiveX (18K)
    Code used in the ActiveX example from week 17.

  • Animation (58K)
    How to incorporate graphics on a form and to use animation.

  • Crystal Report (24K)
    Exactly the same example as ‘Access 97 Databases’ above but with the addition of a Crystal Report which lists book details sorted by publisher.

  • Graphs (3K)
    An example which shows how to alter the values of various points on a graph and how to control the type of graph (e.g. bar chart, line graph, polar, etc.).

  • FlexGrid (4K)
    An example which shows a spreadsheet-like computer inventory which allows products to be added or deleted.

  • MDI Interface (3K)
    A basic example of how to create an MDI text editor. This example also includes basic clipboard functionality to copy and paste text.

  • Mensa Problem (2K)
    The solution of a Mensa problem using the brute force of three nested loops.

  • MMControl (259K)
    An example demonstrating how wave and midi sounds can be played using the MMControl.

  • Pocket Map of Europe (117K)
    This example demonstrates how the PictureClip and Picture controls can be used together to scroll around a large image.

  • Theatre Booking System (18K)
    An example which uses two separate option button groups (using frames) and a spin button linked to a text box.

  • Tic Tac Toe (3K)
    This game is used to demonstrate drag & drop, control arrays and programmer-defined functons.

Other:

  • Visual Basic 5.0 Web Site (868K)
    For those students who would like to utilise information from this site then a ZIP file of it can be downloaded. This can be useful for saving expensive connection charges and also for accessing the site even with no Internet access. All you need is an HTML browser (e.g. Netscape Navigator or Internet Explorer) running locally on your home computer and the above file dezipped. Please note that all HTML pages and graphics from the site are included but the sample projects listed above must be downloaded separately.

  • Windows Help File (3K)
    The help file and RTF source code to complement the Tic Tac Toe example above.

  • Icoholic 3 (788K)
    A collection of 1,500 icons suitable for use in Windows and Visual Basic.


Further Reading

Internet Resources

VB Web Sites:

  • Daniel Wiman’s Visual Basic page - questions & answers, files, code, news, mailing lists, etc.
  • The Most Comprehensive VB List on the Net - links to a wide variety of VB sites
  • Visual Basic Home at Microsoft
  • Visual Basic Online - an online magazine for the Visual Basic programmer
  • Visual Basic Web Directory - links to just about every web site concerned with VB programming

Other Web Sites:

  • activex.com - a large online library of ActiveX components.
  • CPSC 481: Foundations and Principles of Human Computer Interaction - An on-line HCI course run by The University of Calgary.
  • Interface Hall of Shame by Isys Information Architects Inc.

Newsgroups:

  • VB 3rdparty - comp.lang.basic.visual.3rdparty
  • VB Announce - comp.lang.basic.visual.announce
  • VB Database - comp.lang.basic.visual.database
  • VB Misc - comp.land.basic.visual.misc
  • Creating on-line help files - comp.os.ms-windows.programmer.winhelp
  • Human-Factors - comp.human-factors

Visual Basic Sample Projects


VB.NET Excel examples

On this page you will find a set of HowTo samples that can help you to get started with add-in development for Excel 2019, 2016, 2013, 2010 and lower:

And here are a few more VB.NET examples for other applications of the Microsoft Office 2019 - 2000 suite:

Excel extensions: COM add-in, RTD server

Visual Basic 2017 Code Samples

How to develop a COM add-in for Microsoft Office (Excel, Word and PowerPoint)

This sample shared COM add-in for Excel, Word and PowerPoint shows how you can use Add-in Express for Office and .net to add custom command bars and command bar controls, place new controls onto Office Ribbon tabs, create custom task panes, handle application-level events and more.
Download COM addin

How to customize Microsoft Excel ribbon and toolbar

See how to create custom ribbons and toolbars for Excel and how to integrate with an existing Excel tab.
Download add-in

How to customize Excel main menu, context menus and Backstage view

VB.NET sample shows how to create a custom context menu for Excel 2019, 2016, 2013, 2010, 2007 and lower; how to add your own Backstage view item and how to customize the main menu in Excel 2003 - 2000.
Download sample

How to build your first Excel RTD server in VB.NET

See how to build an RTD server step-by-step in the Developer's Guide. The RTD server project is written in Visual Basic .NET. See also a video showing how to create an RTD server.
Download RTD server

Working with Excel Object model

How to handle the WorkbookBeforeSave event

How to create a custom event when Excel calculation mode changes

This VB.NET Excel addin example provides a solution for missing event that should occur then the user changes the calculation mode.
Download addin

How to find the last used cell (row or column) in Excel

This Visual Basic sample explains some reliable methods for finding the last used cell in an Excel worksheet or a range.
Download Find Last Cell add-in

How to populate Excel workbooks and ranges with arrays

2017

VB.NET code example shows how to use arrays to populate Excel with data; how to fill array with a query or range and insert into a worksheet, and more.
Download Populate with Arrays add-in

How to work with Excel tables & ranges using VB.NET

This sample Excel addin demonstrates how work with tables and ranges: create a new table or a range, insert a column or a row, sort, filter and more.
Download Excel Tables and Ranges add-in

How to work with Excel pivot tables

VB.NET code example shows how to automate pivot tables in Excel: create a PivotTable, add calculated fields, display or hide a field; delete, refresh or clear a pivot table; create a pivot chart and more.
Download Excel PivotTables Add-in

Advanced Excel Task Panes

How to show and hide Excel Task Panes programmatically

This Visual Basic .NET Excel sample demonstrates how to set the visibility of an advanced task pane to make it show up from the command bar.
Download VB.NET sample

How to switch between several task panes programmatically

This addin shows how you can use several custom task panes in one position and switch between them programmatically.
Download example

How to show an advanced Excel task pane dynamically

The Excel VB.NET add-in shows how to build a context-dependent custom task pane. The plug-in shows a task pane when cell A1 contains any value.
Download plug-in

How to re-size an Excel task pane in VB.NET

This Visual Basic .NET example shows how you can resize your custom form using Advanced Task Panes for Excel 2019 - 2000. To change the form size programmatically, you set the splitter to none. Otherwise, only the user can resize the task pane using the splitter.
Download sample plugin

User-defined functions

How to develop Excel Automation add-in

See how to create Excel Automation add-ins step-by-step in the Developer's Guide. The sample is written in VB.NET.
Download Automation add-in

How to develop XLL add-in

This sample project demonstrates how you can build an XLL addin in Visual Studio. You can find a detail description of this example in the Developer's Guide: How to create an XLL add-in.
Download XLL addin

Note. You can find plenty more HowTo examples on our technical blog. Be sure to check it out, we add new HowTo samples every week.