How to clear all TextBoxes on a Form – Visual Basic 2010

In this code example you will learn how to clear text boxes in Visual Basic 2010 The following code is for Clear Text Button.click event:  Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim a As Control For Each a In Me.Controls If TypeOf a Is TextBox Then a.Text = Nothing …

Continue reading »

Moving and animating characters – Visual Basic 08/10 Tutorial

In this tutorial you will learn how to move characters with the keyboard and make their legs move when walking with animations.

How to create a class in Visual Basic 2010 – Classes

In this tutorial, we cover how to create a class, how to add members to a class and how to create an instance of a class. This is one of the core concepts of the language itself and it is vital that you understand it. A class is like a blank canvas or a template …

Continue reading »

Write to a Text File on a Website – Visual Basic 2010

In this example you’ll learn how to write to a file on a website. Write to a text file on a website Dim clsRequest As System.Net.FtpWebRequest = _ DirectCast(System.Net.WebRequest.Create(“ftp://domain.com/www/file.txt”), System.Net.FtpWebRequest) clsRequest.Credentials = New System.Net.NetworkCredential(“username”, “password”) clsRequest.Method = System.Net.WebRequestMethods.Ftp.UploadFile ‘/ reading file… Dim bFile() As Byte = System.IO.File.ReadAllBytes(“C:\location\file.txt”) ‘/ upload file… Dim clsStream As System.IO.Stream = …

Continue reading »

How to Send an Email Tutorial – Visual Basic 2010

In this tutorial we will learn a simple how to send email in visual basic 2010. This is a basic SMTP example of how to send mail using the System.Net class library. Add the Buttons and TextBoxes as seen in the image below: Then add the Following Code: Imports System.Net.Mail Public Class Form1 Private Sub Button1_Click(ByVal …

Continue reading »

Verify if Text Entered Into TextBox are Numbers – Visual Basic 2010

How to verify if text entered into the text box is numeric or if it is not then do something. You can use this code with either a Text Changed event or a final check method. Here is the code that verifies TextBox characters are Numbers: If Char.IsNumber(TextBox1.Text.Chars(TextBox1.TextLength – 1)) = True Then Else MsgBox(“Please …

Continue reading »

Search a List Box – Visual Basic 2010 Express Tutorial

In this tutorial you will learn how to search a List Box. For this project I use the following: ListBox1 ListBox2 Button1 TextBox1 Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load With ListBox1.Items .Add(“My name is Jimmy”) .Add(“I am from California”) .Add(“I go to UCLA”) .Add(“I like porgramming …

Continue reading »

Your First Visual Basic Application using Visual Express 2010

Welcome to your first visual basic tutorial, we are going to learn the very basics in this tutorial. I going to assume you already have Visual Basic 2010 Express installed on your PC. Visual Basic Express 2010 and any other versions of Visual Express are all free profucts from Micorsoft, you can download them for …

Continue reading »

Downloading a file With Progress Bar Sample – Visual Basic 2010

This is the simplest and easiest solution to download any file to any location all while displaying the current download progress. Imports System.Net Public Class Form1 Dim WithEvents WC As New WebClient Private Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click WC.DownloadFileAsync(New Uri(“http://www.samplelink.com/Sample/Sample.zip”), ”DownloadedFile.zip”) End Sub Private Sub WC_DownloadProgressChanged(ByVal sender As Object, ByVal e As DownloadProgressChangedEventArgs) Handles WC.DownloadProgressChanged ProgressBar1.Value = e.ProgressPercentage End Sub End Class Or alternatively another version here, in this version you need to add the progress bar to your form: <pre lang="x-vbnet"> Private Sub Button1_Click(ByVal sender …

Continue reading »