private void btnSet_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(tbPath.Text)) { MessageBox.Show(@"Не выбрано изображение."); return; } using (var serviceClient = new CategoryServiceClient()) { using (var stream = new FileStream(tbPath.Text, FileMode.Open, FileAccess.Read)) { serviceClient.SetCategoryImage((int)cbCategories.SelectedValue, (int)stream.Length, stream); } } MessageBox.Show(@"Изображение отправлено"); }