private void ShowIterationSelection()
{
IterationForm iterationForm = new IterationForm(lblProjectID.Text);
iterationForm.ShowDialog();
}
When I show the dialog it displays a list of iterations associated with the project using the ProjectID:
public partial class IterationForm : Form
{
public IterationForm(string projectID)
{
InitializeComponent();
LoadIterationsForProject(projectID);
}
private void LoadIterationsForProject(string projectID)
{
IterationRepository iterationRepo = new IterationRepository();
Int64 ID = Convert.ToInt64(projectID);
dgvIterations.DataSource = iterationRepo.FindAllIterations().Where(i => i.IDProject == ID).Select(i => new { Codigo = i.ID, Descripcion = i.Description, Inicio = i.StartDate, Fin = i.EndDate });
}
}
My question is, how can I capture the selected value from the datagrid view and pass it my calling form to open another form with the select IterationID?
Thanks for the help.
So maybe something like:
private void ShowIterationSelection()
{
IterationForm iterationForm = new IterationForm(lblProjectID.Text);
var result = iterationForm.ShowDialog();
showTheThing(result); //this uses the iterationID
}
Just create a public property on the iteration form that you can access from your main form.
Then you can do: