Hi all
I want to clear the image of the picture box but it is not working when I am using file stream for loading the image.

check out how I add the image in the picture box


vb Code:
  1. Dim fileName As String = String.Empty
  2.                 Dim fileCount As Integer
  3.                 Dim path As String
  4.                 Dim fileStream As FileStream
  5.                 'Process of Loading the company Logo 1
  6.                 If Not IsDBNull(dataTable.Rows(0).Item("CompanyLogo1")) Then
  7.                     Filename= String.Concat(Application.StartupPath, "\CompanyLogo\", dataTable.Rows(0).Item("CompanyLogo1").ToString.Trim)
  8.                     path = System.IO.Path.Combine(Application.StartupPath, "CompanyLogo")
  9.                     fileCount = IO.Directory.GetFiles(path).Length
  10.                     If fileCount >= 1 And File.Exists(fileName) Then
  11.                         fileStream = System.IO.File.OpenRead(Me.companyLogoName1)
  12.                         fileStream.Position = 0
  13.                         Me.companyLogo1.BackgroundImage = System.Drawing.Image.FromStream(fileStream) 'Loading image in the picture box
  14.                         fileStream.Close()
  15.                     End If
  16.                 End If

But this code not clearing the background image why??
vb Code:
  1. Me.companyLogo1.Image = Nothing

Thanks