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:
Dim fileName As String = String.Empty Dim fileCount As Integer Dim path As String Dim fileStream As FileStream 'Process of Loading the company Logo 1 If Not IsDBNull(dataTable.Rows(0).Item("CompanyLogo1")) Then Filename= String.Concat(Application.StartupPath, "\CompanyLogo\", dataTable.Rows(0).Item("CompanyLogo1").ToString.Trim) path = System.IO.Path.Combine(Application.StartupPath, "CompanyLogo") fileCount = IO.Directory.GetFiles(path).Length If fileCount >= 1 And File.Exists(fileName) Then fileStream = System.IO.File.OpenRead(Me.companyLogoName1) fileStream.Position = 0 Me.companyLogo1.BackgroundImage = System.Drawing.Image.FromStream(fileStream) 'Loading image in the picture box fileStream.Close() End If End If
But this code not clearing the background image why??
vb Code:
Me.companyLogo1.Image = Nothing
Thanks




Reply With Quote