Visual Basic Sample Code Hello World

If you have ever learned a programming language, you know that they all start with the 'Hello, world!' Example, and who are we to break such a fine tradition? Start Visual Studio Community (introduced in the last chapter), and select File- New- Project. From the project dialog, select the Console App (.NET framework). There are a huge number of BASIC variants, Visual Basic was a variation that was very popular on Windows in the 90s. This was replaced by Visual Basic.NET (now called just Visual Basic) but was quite different from the earlier versions. Visual Basic is still widely used. 10 PRINT 'Hello, World!' The most important language in the world.

This article applies only to novaPDF. If you don't have it yet, you must download it first.

We strive to keep our articles as accurate as possible. If you notice any inconsistencies or outdated info please let us know.

Sample application that generates a pdf file with Hello World text from Visual Basic (VB).

Hello World VB sample is a simple Windows console application that prints one page with the 'novaPDF says Hello World from VB' text to the novaPDF Printer. This sample can be the base of a more throughout application code that can benefit VB developers.

Note: To be able to use the samples you must install novaPDF SDK as samples work only with it. Download it here: nova PDF SDK.

It demonstrates the basic use of the INovaPDFOptions interface. The printing job is made with calls to the global Printer object defined by VB. It generates a 'HelloWorld.pdf' file and opens it in the default PDF viewer.

Notice: If you print an existing document using ShellExecute() function or you want to handle printing events, you should check the VB Converter sample instead.

Source Code


Related articles
Code Samples for novaPDF SDK
novaPDF SDK includes as part of its documentation several code samples that help developers integrate it faster in their applications, depending on the programming language it is written in. This section includes several code samples showing the various possibilities to send programmatically a print job to the novaPDF SDK printer.
Hello World Visual Basic - SDK sample
Sample application that generates a pdf file with *Hello World* text from Visual Basic (VB).
MFC Scribble - SDK sample
Sample SDK code (csharp) of how to integrate for printing 'Hello World' text to the novaPDF Printer from remote computer.
Hello World (C++) - SDK sample
Sample .cpp SDK code for printing 'Hello World' text to the novaPDF Printer.
[novaPDF SDK] How to generate a pdf file without the Save As dialog
What settings are needed to disable Save As dialog?

The following console program is the Visual Basic version of the traditional 'Hello, World!' program, which displays the string 'Hello, World!'.
The important points of this program are the following:

  • Comments
  • The Main procedure
  • Input and output
  • Compilation and execution
The main Procedure

Visual Basic Sample Code Hello World Paper

Every Visual Basic application must contain a procedure called Main. This procedure serves as the starting point and overall control for your application. It is called when your module is loaded.

Visual Basic Hello World Code

Visual Basic Sample Code Hello World
There are four varieties of Main:
  • Sub Main()
  • Sub Main(ByVal cmdArgs() As String)
  • Function Main() As Integer
  • Function Main(ByVal cmdArgs() As String) As Integer
The most common variety of this procedure is HelloSub Main(). Unless you are creating a Windows Forms application, you must write the Main procedure for applications that run on their own.

Simple Visual Basic Code

To compile and run the program from the IDE

Hello World Visual Basic

  1. Create a Visual Basic console application project.
  2. Copy the code into the project.
  3. Choose the appropriate Build command from the Build menu, or press F5 to build and run (corresponding to Start in the Debug menu).