-1

I am using WinSCP .NET assembly to transfer files by FTP. Couple days ago I developed new module to show pictures in PictureBox control. What I would like to achieve is to list picture's paths inside listbox or whatever else and then when click on this path to be able to open the picture in PictureBox. The point is pictures are on remote location on my FTP and I have no idea is it possible using WinSCP (FTP) to use get their path and then using the paths to show up given picture inside PictureBox. Anyone has idea is it possible or not?

Martin Prikryl
  • 147,050
  • 42
  • 335
  • 704
Arie
  • 1,485
  • 3
  • 15
  • 35

1 Answers1

1

You have to download the file to a local temporary file and load the file to the picture box. You cannot load the remote file directly.

' Unique temporary path 
Dim tempPath As String = Path.GetTempFileName()
' Download the image
session.GetFiles(RemotePath.EscapeFileMask(remoteImagePath), tempPath).Check()
' Load tempPath to picture box
<your code here>
' Delete the temporary file
File.Delete(tempPath)

(I do not do VB.NET, so the syntax may not be 100% correct)

Martin Prikryl
  • 147,050
  • 42
  • 335
  • 704
  • not good i thought there is option in wscp net to be able to show remote picture. Ok so the only way is to list user pictures from remote folder and then when he click on something then application should download picture somewhere in temporary folder and show in picture box right? Then delete.. – Arie Oct 05 '15 at 09:49
  • one question regarding my main topic - how you doing gray color background on some text around? – Arie Oct 05 '15 at 09:51
  • Thanks for accepting my answer. Regarding your question about background color: This is Q&A site, not a discussion forum. Ask a new question. I do not know the answer anyway. – Martin Prikryl Oct 05 '15 at 09:53