using System; using System.Windows.Forms; namespace Tanshu.Accounts.PointOfSale { public partial class VoidReasonListForm : Form { private string[] _list; public VoidReasonListForm(string[] list) { _list = list; InitializeComponent(); } private void VoidReasonListForm_Load(object sender, EventArgs e) { bsList.DataSource = _list; } private void btnExit_Click(object sender, EventArgs e) { this.Close(); } public string SelectedItem { get { if (bsList.Position >= 0) { var item = _list[bsList.Position]; if (item != null) return item; } return null; } } private void dgvVoidReasons_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { this.Close(); } private void dgvVoidReasons_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { var data = dgvVoidReasons.Rows[e.RowIndex].DataBoundItem as string; if (e.ColumnIndex == dgvVoidReasons.Columns["Info"].Index) { e.Value = data; } } } }