private void ComboBox_ObjOfTransact_LostFocus(object sender, RoutedEventArgs e) { if (ComboBox_ObjOfTransact.Text != "0") { int id = 0; ObjectOfTransaction obj; int.TryParse(ComboBox_ObjOfTransact.Text, out id); using (var service = new DataServiceClient()) { obj = service.GetObjectOfTransactionById(id); TextBox_TransactionAmount.Text = obj.Cost.ToString(); ComboBox_KindOfCalc.Text = ((EnumKindOfCalculating)obj.KindOfCalculatingID).ToString(); } } }