private void btnAddFormaPago_Click(object sender, EventArgs e) { var selectedCaja = commB.SetEntity <ControlEntity.Caja>(cajaBindingSource.Current); var formasPagoDisp = LocalData.GetFormasPagoDisponibles(selectedCaja.IdCaja); if (formasPagoDisp != null && formasPagoDisp.Count > 0) { var searchTable = formasPagoDisp.AsDataTable(); // transforma en dataTable var searchForm = new Choose(searchTable, "FormaPago", true); searchForm.ShowDialog(); if (!string.IsNullOrEmpty(searchForm.StringSelectedKey)) { var curKey = searchForm.StringSelectedKey.ToString().Trim(); //if (curKey!=null) ventB.InsertPagoCaja(curKey, Convert.ToInt16(idCajaTextBox.Text)); } GetFormasPago(); } else { MessageBox.Show("No hay formas de pago sin asignar para la caja seleccionada"); } }