Get image from http
I havn't program C# for a while, but now i am starting up again.
This code does work trough the compiler, but in real world it doesn't work, what's the problem?
Sorry about my bad english, i'm from finland (europe).
public class MainsClass
public static void Main()
public class InterfaceClass
Form MainWindow = new Form();
PictureBox MainBox = new PictureBox();
MainWindow.Text = "Startup Screen";
MainWindow.StartPosition = FormStartPosition.CenterScreen;
MainWindow.Width = 640;
MainWindow.Height = 480;
WebRequest reg = WebRequest.Create("http://raceoffice.segel.aland.fi:81/record/current.jpg");
Stream stream = reg.GetResponse().GetResponseStream();
Bitmap img = new Bitmap(stream);
MainBox.BackgroundImage = img;
MainBox.Width = 600;
MainBox.Height = 450;
MainBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
MainBox.Visible = true;
You didn't connect your picturebox to your form in any way, so I guess your form shows up without a picture. But that's just a wild guess, it would really help if you specify "doesn't work" a bit.
Yep, the picturebox doesn't show up, i have tried to connect it, but i don't really know how to do it, after one hour at google and a lot of self thinking, i posted here.
How do i connect it to the form then?
Thank You very much!
Now it work's brilliant.