Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Windows Forms
  4. Workerthread in .Net 1.1

Workerthread in .Net 1.1

Scheduled Pinned Locked Moved Windows Forms
csharpdatabasewinformstoolshelp
2 Posts 2 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    matthias s 0
    wrote on last edited by
    #1

    Hello, I'm looking for a simple sample (or a utility class) on how to build a workerthread for a windows forms application in .Net 1.1. But a search on the articles didn't help really. Following I'd like to do: -> Start the App and display a Form -> Upon "start" button click start the thread (it is doing a couple of database and file operations, each of which must be completed entirely, before processing the next one) -> The thread should be able to update a progress bar on the form and a couple of labels -> When the user hits the "pause" button, the thread must complete the single operation it is currently working on and then wait until the user stops the whole thing completely or hits the "continue" button Can anyone please point me into the right direction? Thanks in advance!

    /matthias

    I love deadlines. I like the whooshing sound they make as they fly by.
    [Douglas Adams]

    S 1 Reply Last reply
    0
    • M matthias s 0

      Hello, I'm looking for a simple sample (or a utility class) on how to build a workerthread for a windows forms application in .Net 1.1. But a search on the articles didn't help really. Following I'd like to do: -> Start the App and display a Form -> Upon "start" button click start the thread (it is doing a couple of database and file operations, each of which must be completed entirely, before processing the next one) -> The thread should be able to update a progress bar on the form and a couple of labels -> When the user hits the "pause" button, the thread must complete the single operation it is currently working on and then wait until the user stops the whole thing completely or hits the "continue" button Can anyone please point me into the right direction? Thanks in advance!

      /matthias

      I love deadlines. I like the whooshing sound they make as they fly by.
      [Douglas Adams]

      S Offline
      S Offline
      ScottM1
      wrote on last edited by
      #2

      Here is an application that I made for an interview that calculates prime numbers.

      //Purpose:to find prime numbers

      using System;
      using System.Drawing;
      using System.Windows.Forms;
      using System.Collections;
      using System.Threading;
      using System.IO;

      namespace Primes
      {

      public class MainForm : System.Windows.Forms.Form
      {
      	private System.Windows.Forms.Button cmdDoit;
      	private System.Windows.Forms.ListBox lbPrimes;
      	private System.Windows.Forms.ProgressBar pbPrimes;
      	private System.Windows.Forms.Label lblValue;
      	Thread t;
      	public MainForm()
      	{
      		
      		InitializeComponent();
      		
      		
      	}
      	
      	\[STAThread\]
      	public static void Main(string\[\] args)
      	{
      		Application.Run(new MainForm());
      	}
      	
      	#region Windows Forms Designer generated code
      	/// /// This method is required for Windows Forms designer support.
      	/// Do not change the method contents inside the source code editor. The Forms designer might
      	/// not be able to load this method if it was changed manually.
      	/// 
      	private void InitializeComponent() {
      		this.lblValue = new System.Windows.Forms.Label();
      		this.pbPrimes = new System.Windows.Forms.ProgressBar();
      		this.lbPrimes = new System.Windows.Forms.ListBox();
      		this.cmdDoit = new System.Windows.Forms.Button();
      		this.SuspendLayout();
      		// 
      		// lblValue
      		// 
      		this.lblValue.Location = new System.Drawing.Point(8, 64);
      		this.lblValue.Name = "lblValue";
      		this.lblValue.TabIndex = 3;
      		// 
      		// pbPrimes
      		// 
      		this.pbPrimes.Location = new System.Drawing.Point(8, 40);
      		this.pbPrimes.Name = "pbPrimes";
      		this.pbPrimes.TabIndex = 2;
      		// 
      		// lbPrimes
      		// 
      		this.lbPrimes.Location = new System.Drawing.Point(8, 96);
      		this.lbPrimes.Name = "lbPrimes";
      		this.lbPrimes.Size = new System.Drawing.Size(136, 290);
      		this.lbPrimes.TabIndex = 0;
      		// 
      		// cmdDoit
      		// 
      		this.cmdDoit.Location = new System.Drawing.Point(8, 8);
      		this.cmdDoit.Name = "cmdDoit";
      		this.cmdDoit.TabIndex = 1;
      		this.cmdDoit.Text = "Calculate";
      		this.cmdDoit.Click += new System.EventHandler(this.CmdDoitClick);
      		// 
      		// MainForm
      		// 
      		this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
      		this.ClientSize = new System.Drawing.Size(152, 398);
      		this.Controls.Add(this.lblValue);
      		this.Controls.Add(this.pbPrimes);
      		this.Controls.Add(this.cmdDoit);
      		this.Controls.Add(this.lbPrimes);
      		this.Name = "MainForm";
      		this.Text = "Primes";
      		this.Closing += new System.Componen
      
      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups