Friday, June 25, 2010

How to login into Youtube, Gmail, Yahoo, Facebook, Hotmail using Visual Basic 2010 or 2008 {VB.net}

Requirements:
4 Textbox (Textbox1, Textbox2, Textbox3, Textbox4)
1 Button (Name: Button1, Text: Set Cursor Position and Log me In"
2 Timers (Timer1 (Interval: 100, Enabled: True), Timer2 (Interval: 10000, Enabled: False)
2 Labels (Name: Label1 (Text: X), Label2 (Text: Y))


Codes:

Public Class Form1
Public Declare Sub SetCursorPos Lib "user32" (ByVal X As Integer, ByVal Y As Integer)
Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Integer, ByVal dx As Integer, ByVal dy As Integer, ByVal cButtons As Integer, ByVal dwExtraInfo As Integer)
Public Const MOUSEEVENTF_LEFTDOWN = &H2
Public Const MOUSEEVENTF_LEFTUP = &H4
Public Const MOUSEEVENTF_RIGHTDOWN = &H8
Public Const MOUSEEVENTF_RIGHTUP = &H10

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
TextBox1.Text = Cursor.Position.X
TextBox2.Text = Cursor.Position.Y
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim first As Integer = TextBox3.Text
Dim second As Integer = TextBox4.Text
SetCursorPos(first, second)
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
Timer2.Enabled = True
End Sub

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
SendKeys.Send("YOUR YOUTUBE USERNAME")
SendKeys.Send("{TAB}")
SendKeys.Send("YOUR YOUTUBE PASSWORD")
SendKeys.Send("{ENTER}")
Timer2.Enabled = False
End Sub
End Class
_________________________________________________________________________

Here is the video tutorial:



Monday, June 14, 2010

Visual Basic - Screen Capturing Program Tutorial - Take a ScreenShot of your screen..! - VB.net

Requirements:
2 Buttons (Name: Button1 (Text: Capture), Button2 (Text: Save)

1 PictureBox (Size Mode: Stretched Image)

1 Timer (Name: Timer1) (Interval approx. 10000)


Codes:

Public Class Form1
'Button 2 = Capture
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Me.Opacity = 0
Timer1.Enabled = True
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim bounds As Rectangle
Dim screenshot As System.Drawing.Bitmap
Dim graph As Graphics
bounds = Screen.PrimaryScreen.Bounds
screenshot = New System.Drawing.Bitmap(bounds.Width, bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
graph = Graphics.FromImage(screenshot)
graph.CopyFromScreen(bounds.X, bounds.Y, 0, 0, bounds.Size, CopyPixelOperation.SourceCopy)
PictureBox1.Image = screenshot
Timer1.Enabled = False
Me.Opacity = 100
End Sub

'Button1 = Save
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim savefiledialog1 As New SaveFileDialog
Try
savefiledialog1.Title = "Save File"
savefiledialog1.FileName = "Save As..."
savefiledialog1.Filter = "JPEG |*.jpeg"
If savefiledialog1.ShowDialog() = DialogResult.OK Then PictureBox1.Image.Save(savefiledialog1.FileName,System.Drawing.Imaging.ImageFormat.Bmp)
End If
Catch ex As Exception
'Do Nothing
End Try
End Sub

End Class
_________________________________________________________________________

Here is the video tutorial:





Wednesday, May 26, 2010

How to Create, Copy, Move, Rename, Delete File or Directory VB.net or Visual Basic

Hello and welcome to another cool vb.net tutorial. Today in this tutorial i will be teaching u all how to use the Directory or File Operations in Vb.net or Visual Basic



Requirements:
4 Timers (Name: Timer1, Timer2, Timer3, Timer4) (Interval: 150, 1000, 1000, 1000)
1 Label (Name: Label1) (Text: Status.)
8 Buttons (Name: Button1, Button2, Button3,Button4, Button5, Button6, Button7, Button8)(Text: Create Directory, Move Directory, Delete Directory, Create File, Copy File, Delete File, Rename File)

Codes:

Imports System.IO
Public Class Form1

Private Sub Form1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Click
Timer1.Enabled = True
Timer2.Enabled = True
Timer3.Enabled = True
Timer4.Enabled = True
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.Enabled = True
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label1.Text = "Status"
Timer1.Enabled = False
Timer2.Enabled = True
End Sub

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Label1.Text = "Status."
Timer2.Enabled = False
Timer3.Enabled = True
End Sub

Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick
Label1.Text = "Status.."
Timer3.Enabled = False
Timer4.Enabled = True
End Sub

Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick
Label1.Text = "Status..."
Timer4.Enabled = False
Timer1.Enabled = True
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Dim path As String = "c:\test"
If Directory.Exists(path) Then
Directory.Delete(path)
Label1.Text = "Directory Deleted Successfully"
Else
Label1.Text = "Directory Not Found"
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = False
Timer4.Enabled = False
If Not Directory.Exists("c:\test") = True Then
Label1.Text = "Directory Does Not Exist..Program will now create a Directory..!"
Directory.CreateDirectory("c:\test\")
Label1.Text = "Directory Created Successfully"
Else
Label1.Text = "Directory Already Exist..!"
End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = False
Timer4.Enabled = False
Dim destination As String = "c:\hello"
Dim path As String = "c:\test"
If Directory.Exists(destination) Then
Label1.Text = "Folder with same name already exist in the destination "
ElseIf Directory.Exists(path) Then
Directory.Move(path, destination)
Label1.Text = "Directory Moved Successfully"
Else
Label1.Text = "Directory Already Exist in the location specified"
End If
End Sub

Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = False
Timer4.Enabled = False
Dim oldname As String = "c:\hello"
Dim newname As String = "c:\Subscribe"
If Directory.Exists(oldname) And Not Directory.Exists(newname) Then
Directory.Move(oldname, newname)
Label1.Text = "Renaming was Successfull"
Else
Label1.Text = "There is folder already with same name in the Directory"
End If
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = False
Timer4.Enabled = False
Dim filetocreate As String = "c:\test.txt"
If Not File.Exists(filetocreate) Then
File.Create(filetocreate)
Label1.Text = "File Created Successfully"
Else
Label1.Text = "File Already Exist"
End If
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = False
Timer4.Enabled = False
Dim path As String = "c:\test.txt"
Dim destination As String = "c:\Subscribe\test.txt"
If File.Exists(path) And Not File.Exists(destination) Then
File.Copy(path, destination)
Label1.Text = "File Copied Successfully"
Else
Label1.Text = "There is already a file called test.txt in the Destination Folder"
End If
End Sub

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = False
Timer4.Enabled = False
Dim filetodelete As String = "c:\test.txt"
If File.Exists(filetodelete) Then
File.Delete(filetodelete)
Label1.Text = "File Deleted Successfully"
Else
Label1.Text = "File Not Found"
End If
End Sub

Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = False
Timer4.Enabled = False
Dim oldname As String = "c:\Subscribe\test.txt"
Dim newname As String = "c:\Subscribe\Subscribe Please.txt"
If File.Exists(oldname) And Not File.Exists(newname) Then
File.Move(oldname, newname)
Label1.Text = "Renaming Was Successfull"
Else
Label1.Text = "File Already Exist with the same name"
End If
End Sub

End Class


Here is the video tutorial:



Sunday, May 23, 2010

Timespan Tutorial - Calculate the Date and Time Difference Between 2 Dates or Times Visual Basic {VB.net}

Hello and welcome to another cool VB.net tutorial by MrVBDude.!!!

Alright today i will be teaching u all how to calculate the time or date difference between two dates of two times.. ok so lets begin..!

REQUIREMENTS:
8 Labels (Name: Label1-Label8) (Text: StartDate, End Date, Start Time, End Time, Total Number of Days, Total Number of Hours, Total Number of Minutes, Total Number of Seconds)
2 DateTimePicker (Name: DateTimePicker1, DateTimePicker2)
8 Textbox (Name: Textbox1-Textbox8) (Text: " ")
1 Button (Name: Button1) (Text: Find Timespan (Time Difference) between 2 dates?)

Codes:

Public Class Form1

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Dim date1 As Date
Dim date2 As Date
Dim difference As TimeSpan
date1 = Convert.ToDateTime(DateTimePicker1.Value)
date2 = Convert.ToDateTime(DateTimePicker2.Value)
difference = date2.Subtract(date1)
TextBox3.Text = FormatNumber(difference.Days, 0)
TextBox6.Text = FormatNumber(difference.TotalHours, 0)
TextBox5.Text = FormatNumber(difference.TotalMinutes, 0)
TextBox4.Text = FormatNumber(difference.TotalSeconds, 0)

End Sub

End Class
_________________________________________________________________________

Here is the video tutorial:

Sunday, May 16, 2010

ProgressBar Visual Basic {VB.net} Detailed Tutorial

Hello and welcome to another tutorial on vb.net. Today in this tutorial i will be teaching u all how to use the progressbar component in visual basic 2005, 2008, 2010.

Requirements:
2 ProgressBar - ProgressBar1, ProgressBar2
1 Label - Label1
4 Buttons (|<<,<<,>>,>>|)

Codes:

Public Class Form1

Dim myprogress As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ProgressBar1.Style = ProgressBarStyle.Marquee
ProgressBar2.Style = ProgressBarStyle.Continuous
ProgressBar2.Step = 1
Timer1.Enabled = True
ProgressBar1.Minimum = 0
ProgressBar1.Maximum = 100
ProgressBar1.Value = 0
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
If ProgressBar1.Value <>
ProgressBar1.Value += 5
End If
End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If ProgressBar1.Value > 0 Then
ProgressBar1.Value -= 5
End If
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
ProgressBar1.Value = 100
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ProgressBar1.Value = 0
End Sub

Private Sub Form1_MouseWheel(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseWheel
If e.Delta > -1 Then
If ProgressBar1.Value <>
ProgressBar1.Value += 5
End If
Else
If ProgressBar1.Value > 0 Then
ProgressBar1.Value -= 5
End If
End If
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
ProgressBar2.Value = myprogress
If myprogress < myprogress =" myprogress">
Label1.Text = "Installing = " & myprogress & "%"
If myprogress = 100 Then
Label1.Text = "Complete"
ProgressBar1.Style = ProgressBarStyle.Continuous
ProgressBar1.Value = 0
Timer1.Enabled = False
End If
End Sub
End Class
_________________________________________________________________________

Here is the video tutorial:




Thursday, May 6, 2010

Hit Enter to Activate a Button Tutorial Visual Basic {VB.net}

Hello and welcome people to another VB.net tutorial. Today in this video tutorial i will be showing u all how to activate or enable or press button when the enter key is pressed on the keyboard.


REQUIREMENTS:

A button
A textbox

Codes:

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MsgBox(TextBox1.Text, vbInformation, "MrVBDude")
End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AcceptButton = Button1
End Sub

End Class_________________________________________________________________________

Here is the video tutorial:

Saturday, May 1, 2010

Format Date and Time Detailed Tutorial Visual Basic {VB.net}

Hi all today i will be showing u all how to format date and time in VB.net.

First of all add one label, 5 timers and 5 buttons to your project.
And then watch the video and images carefully to understand how the form is setup.


Codes:

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer2.Enabled = False
Timer3.Enabled = False
Timer4.Enabled = False
Timer5.Enabled = False
Timer1.Enabled = True
End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label1.Text = TimeOfDay
End Sub


Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Timer1.Enabled = False
Timer3.Enabled = False
Timer4.Enabled = False
Timer5.Enabled = False
Timer2.Enabled = True
End Sub

Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Label1.Text = Format(TimeOfDay, "h:mm:ss tt")
End Sub


Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Timer1.Enabled = False
Timer2.Enabled = False
Timer4.Enabled = False
Timer5.Enabled = False
Timer3.Enabled = True
End Sub

Private Sub Timer3_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer3.Tick

Label1.Text = DateTime.Now.Date
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

Timer1.Enabled = False
Timer2.Enabled = False
Timer3.Enabled = False
Timer5.Enabled = False
Timer4.Enabled = True
End Sub

Private Sub Timer4_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer4.Tick
Label1.Text = Format(DateTime.Now.Date, "MM/dd/yy")
End Sub

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
Timer1.Enabled = False
Timer2.Enabled = False
Timer4.Enabled = False
Timer3.Enabled = False
Timer5.Enabled = True
End Sub

Private Sub Timer5_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer5.Tick
Label1.Text = Format(DateTime.Now, "dd/MM/yyyy")
End Sub

End Class
_________________________________________________________________________

Here is the detailed video tutorial (Voice):



Friday, April 30, 2010

Textbox - Select All (Ctrl+A) and Scroll Visual Basic {VB.net}

Hi all today i will be showing u all how to select all text in a textbox and also how to make a ur text scroll in the textbox

Here are all the codes:

Alright so first of all, u insert one textbox in your form and then u go into the events and choose Keypress event of the textbox and in the code u type in:

Codes:

Public Class Form1

Private Sub TextBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar = Convert.ToChar(1) Then
DirectCast(sender, TextBox).SelectAll()
e.Handled = True
End If
End Sub

End Class
_________________________________________________________________________
Here is the video tutorial:

Run Program on Windows Startup Tutorial Visual Basic {VB.net}

Hi all, today i will be teaching u all how to add and read value from registry in vb.net (visual basic 2008)

Codes:

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim regKey As Microsoft.Win32.RegistryKey
Dim KeyName As String = "Test"
Dim KeyValue As String = "C:\test\test.exe"
regKey=Microsoft.Win32.Registry.LocalMachine.OpenSubKey("Software\Microsoft\Window\CurrentVersion\Run", True)
If regKey.GetValue(KeyName) = Nothing Then
MsgBox("No value found")
regKey.SetValue(KeyName, KeyValue, Microsoft.Win32.RegistryValueKind.String)
MsgBox("keyValue " & KeyName & " has been created")
Else
MsgBox("This Program already exists", vbInformation, "Information")
End If
End Sub

End Class

_________________________________________________________________________

Here is the video tutorial:

Thursday, April 29, 2010

Email Validation Entered Into Textbox Tutorial Visual Basic {VB.net}

Hi all once again, today i will be teaching u all how to validate the email entered into a text box or label to be in correct email format. We will be using Regex to make email validation.

{Note: Remember to rename the "Name" of the textbox1 to "email" or it won't work and please check all the names of the labels from the video tutorial or alter it according to your project.}

Codes:

'General Declarations
Imports System.Text.RegularExpressions
____________________________________________________________________

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim FoundMatch As Boolean
Try
FoundMatch = Regex.IsMatch(email.Text, "\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z", RegexOptions.IgnoreCase)
Catch ex As ArgumentException 'Syntax error in the regular expression
End Try
If Not FoundMatch Then
Label2.Text=("Not a Valid Email Address")
Else
Label2.Text("Valid Email Address")
End If
End Sub

End Class
_________________________________________________________________________

Here is the video tutorial:

Visual Basic Send Email - Smtp Tutorial - {VB.net}

Hello and welcome to another quick VB.net tutorial, today in this tutorial i will be showing u all how to make a VB.net program that sends an email using SMTP client.



Codes:

Imports System.Net.Mail
____________________________________________________________________
Public Class Form1

Private Sub btn_submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_submit.Click
If TB_Name.Text = "" Or TB_Subject.Text = "" Or TB_Cmt.Text = "" Then
MsgBox("Name, Subject and Comment are required fields", vbCritical, "Error") 'This code here test if there is no text in the textbox and if there is no text, it will give an error msgbox and wont progress through the rest of the steps until the user inputs some data in all textboxes.

Else

Try
Dim Mail As New MailMessage 'This code declares a new MailMessage
Mail.From = New MailAddress("mrvbdude2@gmail") 'This is u, who is sending the message to someone else on gmail.
Mail.To.Add("mrvbdude2@gmail.com") 'This is the person u are sending the message to, u should use gmail address here..!
Mail.Subject = TB_Subject.Text & " - " & TB_Name.Text 'Subject of the MailMessage
Mail.Body = TB_Cmt.Text 'Body of the MailMessage
Dim smtp As New SmtpClient("smtp.gmail.com") 'Declares new SMTPCLIENT
smtp.Port = 587 ' SMTP port no.
smtp.EnableSsl = True
smtp.Credentials = New System.Net.NetworkCredential("YOUR GMAIL USERNAME ID HERE", "YOUR GMAIL PASSWORD HERE") 'ur gmail login information
smtp.Send(Mail) 'sends the message u created
MsgBox("Sent Successfully", vbInformation, "Thank you") 'confirmation - message has been send successfully
Catch ex As Exception 'Just incase program runs into error
MsgBox("There was an error, the program will close now!!", vbCritical, "Fatal error")
End Try
End If
End Sub

End Class
_________________________________________________________________________
Here is the video tutorial:

Wednesday, April 28, 2010

How to make form move Borderless (No Title Bar) Visual Basic {VB.net}

Hi all, Today i will be showing u all how to make your vb.net form move without any borders (title bar), so lets begin..!

Codes:

Public Class Form1

#Region " Global Variables "
Dim Point As New System.Drawing.Point()
Dim X, Y As Integer
#End Region

#Region " GUI "
Private Sub Form_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
If e.Button = MouseButtons.Left Then
Point = Control.MousePosition
Point.X = Point.X - (X)
Point.Y = Point.Y - (Y)
Me.Location = Point
End If
End Sub

Private Sub Form_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
X = Control.MousePosition.X - Me.Location.X
Y = Control.MousePosition.Y - Me.Location.Y
End Sub
#End Region

End Class
_________________________________________________________________________
2. Minimize Box: Add one PictureBox component and choose get the image of minimize button from internet and choose that image. Now double click that image and type in the following code.

Minimize Box:
WindowState = FormWindowState.Minimized

--------------------------------------------------
Close box:
me.close
_________________________________________________________________________

Here is the video tutorial:

Thursday, April 22, 2010

Listbox Tutorial - Add, Remove Item, Save, Reload List Visual Basic {VB.net}

Listbox Tutorial - Source Code

Codes:

Public Class Form1

Private Sub cmdAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdAdd.Click
lb1.Items.Add(tb1.Text)
lb1.SelectedIndex = lb1.SelectedIndex + 1
End Sub

Private Sub cmdRem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRem.Click
lb1.Items.Remove(lb1.SelectedItem)
End Sub

Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSave.Click
IO.Directory.CreateDirectory("C:\Test")
Dim w As New IO.StreamWriter("C:\Test\test.txt")
Dim i As Integer
For i = 0 To lb1.Items.Count - 1
w.WriteLine(lb1.Items.Item(i))
Next
w.Close()
End Sub

Private Sub cmdLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdLoad.Click
Dim r As New IO.StreamReader("C:\Test\test.txt")
While (r.Peek() > -1)
lb1.Items.Add(r.ReadLine)
End While
r.Close()
End Sub

End Class
_________________________________________________________________________

Here is the video tutorial: