private void timer_Tick(object sender, EventArgs e) { string message = ""; Server.Service1 server = new Server.Service1(); server.setConnected(lbl_me.Text, true, true); server.getChatText(lbl_me.Text, ref message); if (!(message == "")) { msg n = new msg(message, lbl_connecteduser.Text); flowLayoutPanel1.Controls.Add(n); flowLayoutPanel1.ScrollControlIntoView(n); server.setChatToEmpty(lbl_me.Text); } bool ispassed; bool passed; server.checkimage(lbl_me.Text, out passed, out ispassed); if (passed) { int length; server.getimagelength(lbl_me.Text, out length, out ispassed); byte[] array = new byte[length]; server.getChatImage(lbl_me.Text, ref array); Image img = byteArrayToImage(array); imagemsg p = new imagemsg(lbl_connecteduser.Text, img); flowLayoutPanel1.Controls.Add(p); flowLayoutPanel1.ScrollControlIntoView(p); server.setImageToEmpty(lbl_me.Text); } }