private void buttonAddFile_Click(object sender, EventArgs e) { if (openFileDialog.ShowDialog().Equals(DialogResult.OK)) { if (openFileDialog.FileName != null) { FileInfo fileInfo = new FileInfo(openFileDialog.FileName); FileStream fs = new FileStream(fileInfo.FullName, FileMode.Open, FileAccess.Read); Int64 size = fs.Length; fs.Close(); fileTransferProtocol.FileData.FileList.add(new FileInformation(fileInfo.Name, size, fileInfo.FullName)); TreeNode fileNode = new TreeNode(fileInfo.Name + " (" + (fileInfo.Length / 1024) + " KB) "); fileNode.ImageIndex = 0; fileNode.SelectedImageIndex = 0; treeViewMyFiles.Nodes.Add(fileNode); NetUser[] netUserList = communication.NetUserList.userListToArray(); foreach (NetUser netUser in netUserList) { fileTransferProtocol.sendFileList(netUser); } } } }