Basic Input / Output - Overview

In the following set of sample programs, a number of input / output related topics will be presented:

Msgbox (MessageBox)

Demonstrates the MsgBox function (and MessageBox class), one of the most common ways to display custom messages to the user and accept their input regarding the choice that they have made.

 

InputBox

Demonstrates the InputBox function, a simple way to get one item of input from the user.

 

PrintForm

Demonstrates the PrintForm object, which provides a simple way to print a hard copy image of a form.

 

Hard Copy Printing

(using the PrintDocument object)

Demonstrates how to use the PrintDocument object to print a basic report without using a report designer component or other third-party tool.

 

PrintPreviewDialog control

Extension of the hard copy / PrintDocument example described above, which shows how to present a Print Preview to the user prior to, or instead of, printing directly to the printer.

 

Console application

Demonstrates how to create a Console application, which lets you write an application that uses a command-line (MS-DOS-like) interface rather than a GUI form-based interface.

 

 

In general, the tutorials and sample programs presented on this page of The VB Programmer website ("VB Tutorials – VB.NET (VB 20XX)") are presented in a sequence such that each example or set of sample programs builds on what you have seen before. This set of examples breaks that rule, as it is intended as a "survey" of various techniques to perform input and output operations. As a new programmer, or as an experienced programmer learning a new language, one of the first things you may want to know is how get data from the user and how to display information back to the user via your program. This set of programs is intended to satisfy that curiosity.

Msgbox and InputBox are simple enough. Using PrintForm is easy as well, however the sample program does use elements on the form (such as images) that have not been presented previously. The most complex sample programs of the group are the two examples that use the PrintDocument object; as these examples process an input data file and use a printing event model that you may initially find unintuitive. The good news is that you can come back to these later on and possibly use them as templates for occasions when a project you are working on has similar requirements.

The Console application will return us to more of an introductory mode; and console applications will be used in a number of the next groups of programming examples where the focus will be on programming language elements and basic programming fundamentals rather than on GUI form-based elements. But not to worry – there will be plenty of GUI Windows Forms examples following that.