Fetstil Fetstil Kursiv Understrykning linje färgläggning tabellverk Punktlista Nummerlista Vänster Centrerat högerställt Utfyllt Länk Bild htmlmode
  • Forum & Blog
    • Forum - översikt
      • .Net
        • asp.net generellt
        • c#
        • vb.net
        • f#
        • silverlight
        • microsoft surface
        • visual studio .net
      • databaser
        • sql-server
        • databaser
        • access
        • mysql
      • mjukvara klient
        • datorer och komponenter
        • nätverk, lan/wan
        • operativsystem
        • programvaror
        • säkerhet, inställningar
        • windows server
        • allmänt
        • crystal reports
        • exchange/outlook
        • microsoft office
      • mjukvara server
        • active directory
        • biztalk
        • exchange
        • linux
        • sharepoint
        • webbservers
        • sql server
      • appar (win/mobil)
      • programspråk
        • c++
        • delphi
        • java
        • quick basic
        • visual basic
      • scripting
        • asp 3.0
        • flash actionscript
        • html css
        • javascript
        • php
        • regular expresssion
        • xml
      • spel och grafik
        • DirectX
        • Spel och grafik
      • ledning
        • Arkitektur
        • Systemutveckling
        • krav och test
        • projektledning
        • ledningsfrågor
      • vb-sektioner
        • activeX
        • windows api
        • elektronik
        • internet
        • komponenter
        • nätverk
        • operativsystem
      • övriga forum
        • arbete karriär
        • erbjuda uppdrag och tjänster
        • juridiska frågor
        • köp och sälj
        • matematik och fysik
        • intern information
        • skrivklåda
        • webb-operatörer
    • Posta inlägg i forumet
    • Chatta med andra
  • Konto
    • Medlemssida
    • Byta lösenord
    • Bli bonsumedlem
    • iMail
  • Material
    • Tips & tricks
    • Artiklar
    • Programarkiv
  • JOBB
  • Student
    • Studentlicenser
  • KONTAKT
    • Om pellesoft
    • Grundare
    • Kontakta oss
    • Annonsering
    • Partners
    • Felanmälan
  • Logga in

Hem / Forum översikt / inlägg

Posta nytt inlägg


IF I start multiple instances of a class that I need to contact while it's runni

Postades av 2004-01-22 08:24:34 - paul horsley, i forum vb.net, Tråden har 2 Kommentarer och lästs av 685 personer

Dear All,

Project....

A VB.Net exe that when running starts multiple instances of a class, the worker class has the job of at given intervals move and adjust contents of some text files.
No I need to be able to from one form see how the class is processing, what it has processed.
How can I do this.

example...

Start exe..
create 3 instances of the worker class.....
Worker class runs and is doing it's job as definned.
User selects from a list provided a job instance to see how it's doing
The exe should get contact with a method within the selected worker job/class and
the class should return some relevant information to a windows form.
The user should be able to even pause, stop the worker class if required.
any ideas ?
regards /Paul








Svara

Sv: IF I start multiple instances of a class that I need to contact while it's r

Postades av 2004-01-22 08:39:23 - Mikael Sand

I'm thinking events...
Provided I have understood what you are trying to do I would do something like this:

The worker class (marxist?) exposes one event that triggers on some kind of processing progress, like every 1000 row processed in the file.
This class has been definied and initialized from the main form. That form does not register for the event until the user has clicked a button that says something like "tell me how you are doing".
The clickevent adds a handler for the event in the working class and a sub or function processes it.
The working class:
<code>
Public event Processing()

Public funtion StartProcess()
' code here
' On some criteria met
raiseevent me.Processing
end function
</code>
The form:
<code>
private withevents wClass as workingclass

private sub btnStartProcess_Click(...)
wClass = new workingclass
wClass.StartProcess()
end sub

private sub btnHowYaDoin_Click(...)
addhandler wClass.Processing, addressOf me.HowAreTheWorkers
end sub

private sub HowAreTheWorkers()
messagebox.show("The workers are working")
removehandler wClass.Processing
end sub
</code>
All this requires you to start the wclass-process in a different thead and then implement it.

//Mikael Sand


Svara

Sv: IF I start multiple instances of a class that I need to contact while it's r

Postades av 2004-01-28 19:05:35 - paul horsley

Dear Mikael,
Thanx for that, I was thinking about using threads as well, but my problem was then that at some point I want to kill the thread ( or at least the user would ) if not kill it then at least pause a timer that would be running on the worker ( as all workers would basically be looking in folder A for file type A and moving them to Folder B and logging all actions processed ). also I would want to give the worker new instructions if the user decide that the worker should look in another folder or for another type of file to process.

I got som einfo about having to cache the thread id or something, but I did not feel that comfortable with the idea. but if you got any sample code and are interested in sharing then I'l have a bash.

again thanx for good thoughts.
cheers Paul


Svara

Nyligen

  • 19:55 kick-off med fokus på hälsa?
  • 19:53 kick-off med fokus på hälsa?
  • 16:24 Föreslå en skönhetsklinik online
  • 16:23 Föreslå en skönhetsklinik online
  • 18:42 Hvor finder man håndlavede lamper
  • 18:41 Hvor finder man håndlavede lamper
  • 16:36 Allt du behöver veta om keramiskt
  • 16:14 Vem anlitar man egentligen när tak

Sidor

  • Hem
  • Bli bonusmedlem
  • Läs artiklar
  • Chatta med andra
  • Sök och erbjud jobb
  • Kontakta oss
  • Studentlicenser
  • Skriv en artikel

Statistik

Antal besökare:
Antal medlemmar:
Antal inlägg:
Online:
På chatten:
4 570 719
27 958
271 751
5 820
0

Kontakta oss

Frågor runt konsultation, rådgivning, uppdrag, rekrytering, annonsering och övriga ärenden. Ring: 0730-88 22 24 | pelle@pellesoft.se

© 1986-2013 PelleSoft AB. Last Build 4.1.7169.18070 (2019-08-18 10:02:21) 4.0.30319.42000
  • Om
  • Kontakta
  • Regler
  • Cookies