private static void PrintScreenAndPost(object a, object bee) { nIco.Icon = b; Bitmap bit = PrintScreen(); try { using (var w = new WebClient()) { string clientID = "7ee07fb80bd19ec"; w.Headers.Add("Authorization", "Client-ID " + clientID); var values = new NameValueCollection { { "image", Convert.ToBase64String(ImageToBArr(bit)) } }; byte[] response = w.UploadValues("https://api.imgur.com/3/upload.xml", values); XDocument xml = XDocument.Load(new MemoryStream(response)); XElement node = xml.Element("data").Element("link"); PS.Post p = new PS.Post(node.Value, bit); p.ShowDialog(); } } catch (Exception e) { MessageBox.Show("Error uploading file: " + e.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } nIco.Icon = w; bit.Dispose(); }