Visual Basic [VB] Programming Tutorials

Visual Basic or VB Programming Tutorials And Articles
  Title Reverse Sort Order / Author Replies
By definition, an array is a list of variables, all with the same data type and name. When we work with a single item, we only need to use one variable. However, if we have a list of items which are of similar type to deal with, we need to declare an array of variables instead of using a variable...
When a List Box control has the focus, it will automatically scroll to the first item that begins with the letter you type. It will not, however, automatically select items based on more than the first letter. For example, if you type go, you may want the control to select the first item that...
Here's a cool, handy macro that will auto-generate a Table of Contents for any Excel file. Steps remains the same as in any macro (Alt F11 to start VBA, Insert module, paste the code, save, File -> Return to Excel, then Alt F8, and Run). That's a mouthful, but you know what to do. Sub...
Useful Binary Conversion. This program convert Binary to text and text to binary. This program has one Form1 (Main.frm), textbox (Text1.Text), two button, (cmdConvtoBin and cmdConvtoText) and a module1 (Binary.bas) - Form Command Private Sub cmdConvtoBin_Click() MainText = Text1.Text...
Developers often deal with various date calculations in applications. If you need a simple way to figure out how many days there are between two given dates, consider using VB.NET's TimeSpan object. Snippet A shows how you can use the TimeSpan object to obtain the elapsed amount of time...
An important function of any program is the ability to work with a file system and manipulate files and directories. In this tip, we examine how to work with a file system using VB.NET. Lets see how to perform necessary functions with examples that utilise the existing classes, their methods, and...
When dealing with dates in VB.NET, it's a good idea not to perform manual checks or calculations, which may be inaccurate depending on the quality of the code. Instead, it's advisable to rely on the functionality of classes provided by .NET. For instance, if you need to determine if a given...
A class is a part of the program that defines the properties, methods and events of one or more object that will be created during execution. An object is an entity created at run time, which requires memory and some resources and is then destroyed when it's no longer needed or when the application...
Command buttons appear in almost every window of every Windows application. Command buttons determine when the user wants to do something such as exit the application or begin printing. In almost every case, you will perform these tasks to add a command button to an application: 1. Locate and...
A constant is a meaningful name that takes the place of a number or string that does not change. Constants store values that, as the name implies, remain the same throughout the execution of an application. You can greatly improve the readability of your code and make it easier to maintain by using...
The controls you select for your application's form are important because the controls (also called tools) provide the application interface for your users. Users interact with your application by clicking the controls and entering text in the controls. Placing and sizing controls are perhaps the...
Put on form Picture Box control and button. Set property ScaleMode to 3-Pixel and post this code: Private Sub Command1_Click() Dim arr(1000, 1000) As Integer Dim i Dim y Dim iSumRed As Integer Dim iSumBlack As Integer iSumRed = 0
Temp files are generally used for temporary storage and data manipulation. This is often necessary for storing user data, user preferences, session information, application cache, and many other types of information. In order to get the name of the file that you can use as a temp file in...
When you decide to use a variable, you are in fact asking the computer to use a certain amount of space to hold that variable. Since different variables will be used for different purposes, you should specify the kind of variable you intend to use, then the computer will figure out how much space...
While it has become common practice for developers to manipulate VB.NET date/time values manually, it's never a good idea because the result is rarely a correct date/time value. Whenever you try to use your own calculation routines for adding and subtracting date/time values, you risk generating a...
All comparison operators produce true or false results. In other words, the comparison is either true or the comparison is false. The mathematical operators produce numeric values, whereas the comparison operators produce only true or false values. The rest of the program can use the true or false...
I have searched long enough to release that there's no other SIMPLER way to archive the task of dragging out a virtual file ( a file that alreagy does not exist) Out of a program. This method is not 100% perfect but of course may be easier than calling the harsh shells. Background I...
Though VB is an object oriented language with multithreading I was always dissapointed with its less flexibility in using threads with the GUI. Of course many of you may have seen this InvalidOperationBlahException saying you cannot put up a progress bar/ timer./ count down iun a seperate thread...
One of the most reputable changes in the Visual Basic language is the introduction of structured exception handling in VB.NET. While the latest version of the language still supports the On Error Goto type of error handling, it's not preferred; instead, you should use structured exception handling....
While core functionality and useability of the application is always one of the most important aspects, various visual effects may improve the way users feel about a particular application. Even though you may be able to implement purely cosmetic features in an application, it's important to keep...