Класс для передачи значения
Код: Выделить всё
public class CommonValues
{
public string MRNO { get; set; }
}
Код: Выделить всё
public partial class showmr : Form
{
List truIndexes = new List();
private pendingrequest _masterForm;
}
public showmr(pendingrequest masterForm)
{
InitializeComponent();
_masterForm = masterForm;
}
pendingrequest frm;
private void button1_Click(object sender, EventArgs e)
{
try
{
List CVV = new List();
foreach (DataGridViewRow item in dataGridView1.Rows)
{
if (Convert.ToBoolean(item.Cells[6].Value))
{
CVV.Add(new CommonValues
{
MRNO = item.Cells[6].Value,
});
}
else
{
}
}
if (CVV.Count > 0)
{
_masterForm.AddToGrid(CVV);
MessageBox.Show(CVV.ToString());
this.Close();
}
else
{
MessageBox.Show("Quantity shouldn't be empty");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
введите здесь описание изображения
I попробовал использовать TryParse, но тоже выдал ошибку.
Код: Выделить всё
if (Boolean.TryParse(item.Cells[6].Value)) = true;
Подробнее здесь: https://stackoverflow.com/questions/789 ... lid-boolen