KNOWARE  

Software for Education and Industry



Getting Started with

Visual Basic .NET and SQLite

                                    

What is Visual Basic .NET?

Visual Basic .NET, also called Visual Basic Studio, is the Visual  Basic language portion of Microsoft's Visual Studio.  Visual Studio consists of a suite of programming languages including C, C++, C++/CLI, Visual Basic .NET, C#, F#, JavaScript, TypeScript, XML, XSLT, HTML, and CSS, and other languages available via plug-ins. Support for all these languages is built into one common IDE, or Integrated Development Environment program, called Visual Studio. Visual Studio is Microsoft's attempt to make one IDE in which multiple programming languages can be used to make applications for multiple platforms, such as Windows, the Internet, Xbox, Windows Phone, Linux, macOS and Android.

Visual Studio comes in four editions:
Of these editions, only the Community edition is free.  And that is the edition we will download for this tutorial.

If all this seems a bit overwhelming; fear not!  In spite of its immense capabilities, the latest edition of Visual Studio is very user friendly and this tutorial will focus only on the Visual Basic portion of Visual Studio, along with the basics of object oriented programming (OOP) and how to connect and use SQLite, a stand-alone database useful for many applications.


A Short History of BASIC:

BASIC (Beginner's All-purpose Symbolic Instruction Code) is a general-purpose, high-level programming language first developed in 1964Because its syntax was easier to read than many other programming languages, it quickly gained in popularity,  In 1991, Microsoft came out with Visual Basic which allowed users to create Windows programs.  That edition of Visual Basic incorporated many of the feature of an object oriented program (OOP), but lacked some features such as "inheritance".  With the introduction of Visual Basic .NET in 2001, however, Visual Basic became a full fledged OOP program with all the features of C, C#, etc.

What is SQLite?

SQLite is an embedded SQL database program that runs on your local computer, as opposed to running on a server like Microsoft SQL Server or MySQL.  Go here for a complete explanation of database programs compatible with Visual Studio.  Many programs can benefit from using an embedded database program like SQLite.  For example, my programs Group Scheduler 2.2 and Health Tracker both use SQLite to keep track of activities being scheduled or health events.


What You Will Learn in this Tutorial:
How to use this tutorial:

Read the chapters of this tutorial in the order in which they are presented because they build on one another.  The code for most chapters is included in the Examples folder of this program.  You will get the most benefit from this tutorial, however, if you type in  your own code as opposed to just viewing the examples.  In other words, learn by doing.

There is a lot of information on the Internet regarding Visual Basic .NET and SQLite, and indeed this tutorial refers you to some of those sites.  But often times explanations and examples on the Internet are cluttered with extraneous information that makes them more useful as a reference than a leaning tool. 

All examples in this tutorial are kept as simple as possible to illustrate the topic at hand (so you don't get "lost in the weeds").




Getting Started with
Visual Basic .NET and SQLite

Table of Contents

               Chapter

               1.    Introduction               

                      
               2.    Launching Visual Studio
                         Download Visual Studio
                         Install Visual Studio
                         Summary                         

               3.  Creating Your First Program (Hello World!)
                         Open Visual Studio
                         Create a New Project
                         Program and Run the Project
                         Examine the Files
                         Summary                                   

               4.  Deploying Your Program
                        Open the Hello World project
                        Use the Publish Project Wizard
                        Summary

               5.  Methods (Subroutines and Functions)
                        Introduction
                        Create a New Project
                        Build Form1
                        Set the Properties
                        Add Two Numbers Using a Subroutine
                        Add Two Numbers Using a Function
                        Combine Two Strings Using a Subroutine
                        Combine Two Strings Using a Function
                        Summary                      

          

                6.  Branching (If...Else, Select Case)
                        Introduction
                        Create a New Project
                        Build Form1
                        Code IF...Else Statements for Button1_Click
                        Code Select Case Statements for Button1_Click
                        Summary

                 7. Looping (For..Next, While, Do While)
                        Introduction
                        Create a New Project
                        Build Form1
                        Run the For...Next Example
                        Run the While Example
                        Run the Do While Example
                        Summary

                8.  Arrays
                        Introduction
                        Create a New Project
                        Build Form1
                        Fill the ListBox from a list of variables
                        Fill the ListBox from an array
                        Add New Names to the Array at Runtime
                        Create a 2 Dimensional Array
                        Summary

         
              9.  Classes

                       Introduction        
                       Create a New Project
                       Build Form1
                       Add a Class named Houses to the Project
                       Program the Class named Houses
                       Program Form1
                       Run the Program
                       Summary


            
10.  Stand-Alone Classes (.dll Files)

                       Introduction
                       Create a Stand-Alone Class
                       Program and Build the Stand-Alone Class
                       Create a New Project
                       Build Form1
                       Program Form1
                       Run the Program
                       Summary

 

             11.  Inheritance

                       Introduction
                       Create a New Project
                       Build Form1
                       Add a Class named DerivedClass to the Project
                       Add a Reference to the Class to be Inherited
                       Program the DerivedClass
                       Program Form1                      
                       Run the Program
                       Summary
  
             12.  SQLite 
                       Introduction
                       Download and Install SQLite Studio
                       Build the Database
                       Add data to the Database
                       Summary 

             13.  Connecting Visual Basic.Net to SQLite
                       Introduction
                       Installing the ADO.NET Data Provider
                       Building Form1
                       Connecting to the Database
                       Getting Data from the Database
                       Adding, Changing, and Deleting Data
                       Summary 

 

Sample excerpt from...

Chapter 3. Creating Your First Program

Step 3)  Program and Run the Project

Your screen should now look similar to Figure 5 below. The center window labeled "Form1.vb (Design)" is where we will design the form the user will see when they run the program. Notice the other windows that have been created automatically for the development of the application. If all of these windows are not displayed, click on the menu item View at the top left-hand side of the screen, then click on their name to display them.
Figure 5. Application ready to be programmed



Hardware/Software Requirements: Return to home page.
Go to order form.