lstDisplay
Public Sub Form_Load() Form1.BackColor = RGB(0, 0, 255) 'Gives colour to form End Sub Adds the data inserted in the text boxes in the text file called Sales defines data type, assigns the variables with the content of text boxes if the variables are empty then displays message in the gray shaded box else opens file, places pointer at the end and writes the data once they have been written we clear the text boxes Private Sub cmdAddToFile_Click() Dim Name As String Dim Region As String Dim Amount As String Dim FileName As String FileName = App.Path & "\Sales.txt" Name = txtName.Text Region = txtRegion.Text Amount = txtAmount.Text If (Name = "" Or Region = "" Or Amount = "") Then lblMessage.Caption = "MISSING DETAILS." Else Open FileName For Append As #1 Write #1, Name, Region, Amount 'Write puts quotes and separates with commas Close #1 txtName = "" txtRegion = "" txtAmount = "" txtName.SetFocus End If End Sub