Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3358860
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:48:09+00:00 2026-05-18T02:48:09+00:00

private void ShowIterationSelection() { IterationForm iterationForm = new IterationForm(lblProjectID.Text); iterationForm.ShowDialog(); } When I show

  • 0
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
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:48:10+00:00Added an answer on May 18, 2026 at 2:48 am

    Just create a public property on the iteration form that you can access from your main form.

    public partial class IterationForm : Form
    { 
        // set this to the selected object (change to w/e type you need)
        public object SelectedObject{get; private set;}
        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 });
        }
    }
    

    Then you can do:

    private void ShowIterationSelection()
    {
        IterationForm iterationForm = new IterationForm(lblProjectID.Text);
        var result = iterationForm.ShowDialog();
        showTheThing(iterationForm.SelectedObject); //this uses the iterationID
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

private void dcHullForUpperHull(List<Point> list, Point p, Point q) { List<Point> upperH = new ArrayList<Point>();
private void GeoCode_Method1(string myaddress, int waypointIndex, string callingUser) { GCService.GeocodeCompleted += new EventHandler<NSpace.GCService.GeocodeCompletedEventArgs>(GeoCode_Method1_GeocodeCompleted); GCService.GeocodeAsync(request,
private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar < '0' || e.KeyChar >
private void LoadUsersToComboBox() { comboBox1.DataSource = null; comboBox1.DataSource = peopleRepo.FindAllPeople(); /*Returns IQueryable<People>*/ comboBox1.DisplayMember =
private void equal_AxB() { int x = matrix_A.length; int y = matrix_B[0].length; matrix_C =
private void doShareEmp(pageBean UTIL, HttpServletRequest request, String page) throws Exception { doAction(request, UTIL, page);
private void button1_Click(object sender, EventArgs e) { PROGRESS_BAR.Minimum = 0; PROGRESS_BAR.Maximum = 100; PROGRESS_BAR.Value
private void Form1_Load(object sender, System.EventArgs e) { StartToFillTree(); } private void StartToFillTree( ) {
private void button1_Click(object sender, EventArgs e) { Insert(); } private int Insert() { string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.