Thanks guys.
I tried that and ended up with this chunk of code:
TcpClient S = new TcpClient("localhost", 50001);
NetworkStream NS = S.GetStream();
Picture.Image = Image.FromStream(NS);
Picture.Refresh();
NS.Close();
S.Close();
It works 100% fine. I could receive image files (bmp/jpg) in size from 4k
upto 1.6Mb and they displayed perfectly.
Peter.
"Landley" wrote:
> This is the correct way.
>
>
> "Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com> wrote
> in message news:(E-Mail Removed)...
> > I haven't tested this and not positive that it would work, but can't you
> use
> > the share function Image.FromStream(Stream) as Image. Just pass in your
> > stream.
> >
> > Chris
> >
> >
> > "PHS" <(E-Mail Removed)> wrote in message
> > news
4306DB4-879A-4A69-8D67-(E-Mail Removed)...
> > >I have a c# client application that connects to a network socket. When
> > > connected, the listener sends a network stream containing bitmap, jpeg,
> > > data
> > > from a file nominated by the client. The client application (also c#)
> > > receives the data into a byte[] array. I want to pass the byte[] array
> > > directly to a picture control on the form. I can't find a way to do this
> > > so I
> > > used a file stream and write the byte[] array to a file, and then pass
> > > that
> > > pathname into the Image.LoadFile(pathname) method and then assign the
> > > image
> > > to the picture, as in Picture.Image = RuntimeImage.
> > >
> > > This works but having to use an interface file to get the data into the
> > > picture control is not ideal. Is it possible somehow to massage the
> byte[]
> > > array I got from the NetworkStream directly to the Picture control?
> >
> >
>
>
>