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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:57:04+00:00 2026-06-11T11:57:04+00:00

this is my problem… I have a Windows Forms with a ListBox and a

  • 0

this is my problem… I have a Windows Forms with a ListBox and a RichTextBox, and a separate class file with some functions…

I know how to update a simple textbox, but not a listview, because if I use the same code, I get 1 new item for every step of myFunc, and the point is this:

//myFunc loads
var lv = listProcess.Items.Add("This is my item");
//myFunc step1
lv.SubItems.Add("Column2 step1 status");
lv.SubItems.Add("Column3 step1 status");
lv.SubItems.Add("Column4 step1 status");
//myFunc step2
lv.SubItems.Add("Column2 step2 status");
lv.SubItems.Add("Column3 step2 status");
lv.SubItems.Add("Column4 step2 status");
//myFunc ends
//Remove item "lv" from listview.

I hope someone can help me…

form1.cs

public Form1()
    {
        InitializeComponent();
        var func = new System.Threading.Timer(otherclass.myFunc, null, 0, 60000);
    }

otherclass.cs

public class otherclass
{
    public static void myFunc(object sender)
    {
        var lv = listProcess.Items.Add("This is my item");
        for(int i; i <= x; i++)
        // Update lv subitems here
        next
        // Update richTextBox1 here when all steps are done

    }
}

I hope someone can help me because I’m so lost

  • 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-11T11:57:05+00:00Added an answer on June 11, 2026 at 11:57 am
    public class otherclass   // otherclass means: should not know about ListViews or RTBs
    {
        public static void myFunc(object sender)
        {
            var lv = listProcess.Items.Add("This is my item");
            for(int i; i <= x; i++)
            // Update lv subitems here
            next
            // Update richTextBox1 here when all steps are done
    
        }
    }
    

    To your general problem:

    1. Use a WinForms timer (not Threading.Timer)
    2. When it ticks, start a Backgroundworker
    3. The Bgw executes the function in DOWork, update the ListView in Completed.

    So what you need is a dataformat (List<string> or something more involved) to be returned from MyFunc().

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

Sidebar

Related Questions

This problem occurs in both NHibernate 2 and 3. I have a Class A
This problem has bugged me so many times and i have now decided to
This problem has been driving me mad. Here's the general gist: I have two
This problem has bothered me for a long time.As we know,in mathematica we can
This problem is making me crazy. Actually I have multiple problems. First one: Why
This problem is driving me nuts. I have a prototype UITableViewCell in my storyboard.
This problem may be a bug. i have spent too much time trying to
This problem has bothered me for a while and Im sure theres some sort
This problem is not critical... but would be helpful for me to know the
This problem drives me crazy.I have vectorA(float),vectorB(string1),vectorC(string2) which are parallel and i want to

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.