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 8264795
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:34:59+00:00 2026-06-08T04:34:59+00:00

The flow of code doesn’t follow my logic, and my lists don’t get the

  • 0

The flow of code doesn’t follow my logic, and my lists don’t get the required output.

public static List<String> genericList;
public static List<String> List1;

in frmLoadCurrentForm():

List1 = new List<String>();
genericList = new List<String>();

Then, in various places (? buttons)

1 private void btn1_Click(object sender, EventArgs e)
2 {
3     genericList = List1.ToList();
4     call(); 
5     List1 = genericList.ToList();
6 }
private void call()
{
    frmForm form = new frmForm();            
    for (int i = 0; i < genericList.Count(); i++)
        form.lst.Items.Add(genericList.ElementAt(i));
    form.Show();
    //form updates genericList on exit with lst contents, tested
}

While stepping through my code, I put a breakpoint on line 5, and code goes to line 5 then 4 (and into the form), then doesn’t go back to 5 – so my List1 doesn’t get updated with what happens inside the call().

I don’t understand this logic, or what to do about it.

I am using multiple lists and a single genericList so that I can use a complicated interface for multiple situations, and theoretically my logic seems valid…

At the exit from the form, genericList has the right info, List1 doesn’t. Why ?

Edit: added declaration of lists

Edit: As I step through, the form will start rendering but will not finish until the code at the end of the button that called the method that created the form got executed. Which is even more odd, since the form instance is created in a method so it should be closed and disposed of at the end of the method…

  • 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-06-08T04:35:01+00:00Added an answer on June 8, 2026 at 4:35 am

    It was definitely a threading problem.

    To solve it the easiest way possible (instead of creating a separate thread), I replaced form.Show() with form.ShowDialog();

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When debugging asp.net code in visual studio, the flow doesn't go to dependancy files
Why gose to image's flow This is code: <p><img class=left width=95 height=64 src=# />
I am tired of debugging a flow of my official project code - it
I just read in Code Complete that you should not use exceptions for flow
$subject= Citation flow <img src='/static/images/icons/help.png'> </span> </p> <p style='font-size: 150%;'><b>11</b></p>; $pattern=/Citation flow[.]+<b>([0-9]+)<\/b>/i; preg_match_all($pattern, $subject,$matches,PREG_PATTERN_ORDER);
I'm looking for ways to obfuscate the following c#/silverlight source code: if (searchBox.Text.Equals(string literal)){
I am trying some code like this //A.hpp class A{ public: A() {} virtual
The code below has (at least) two problems: the Copy button doesn't update the
Can anyone explain me execution flow for the following java code ?? Sorry for
I'm using Emacs and trying to get my unit testing work flow as automated

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.