When I do a long calculation is there a possibility to interrupt this
calculation properly?
For i as integer = 1 to 100000000
do something
next
and retrieve the i at the moment of the interrupting
Thanks for any response 8 1220
Hello Andreas,
The term is: coroutine
This article describles how to implement coroutines using the Win32 Fiber
API: http://msdn.microsoft.com/msdnmag/is...T/default.aspx
-Boo When I do a long calculation is there a possibility to interrupt this calculation properly?
For i as integer = 1 to 100000000 do something next and retrieve the i at the moment of the interrupting
Thanks for any response
Do you mean this:
dim iAfterLoop as integer
for i as integer =1 to 10000000
if i = something then
iAfterloop = i
end for
end if
next
Ahmed
andreas wrote: When I do a long calculation is there a possibility to interrupt this calculation properly?
For i as integer = 1 to 100000000 do something next
and retrieve the i at the moment of the interrupting
Thanks for any response
No, Ahmed I am thinking at the event of closing my form.
"Ahmed" <ah*******@gmai l.com> wrote in message
news:11******** *************@m 73g2000cwd.goog legroups.com... Do you mean this:
dim iAfterLoop as integer
for i as integer =1 to 10000000
if i = something then iAfterloop = i end for end if next
Ahmed andreas wrote: When I do a long calculation is there a possibility to interrupt this calculation properly?
For i as integer = 1 to 100000000 do something next
and retrieve the i at the moment of the interrupting
Thanks for any response
Hello Andreas,
Ah, I misunderstood as well. If yer looking for how to interrupt at form
close, perhaps for the purpose of continuing the long op at the next run..
it's pretty simple.
Im the Form_QueryClose event set a varaible.. like bFormClosing to True..
Then in the loop ask the variable if the form is closing.. and if it is,
exit the op. (Exit For).
-Boo No, Ahmed I am thinking at the event of closing my form.
"Ahmed" <ah*******@gmai l.com> wrote in message news:11******** *************@m 73g2000cwd.goog legroups.com... Do you mean this:
dim iAfterLoop as integer
for i as integer =1 to 10000000
if i = something then iAfterloop = i end for end if next Ahmed andreas wrote: When I do a long calculation is there a possibility to interrupt this calculation properly?
For i as integer = 1 to 100000000 do something next and retrieve the i at the moment of the interrupting
Thanks for any response
Note that this aproach will only succeed if the loop is started with a
asynchronous delegate
Otherwise the form will simply freeze untill the loop has completed and
pressing the close button will result in a " This program is not responding
message "
But for the rest you are right you can then set a boolean flag to jump out
of the loop and let the function or a property setter return the value to
the initial caller
regards
Michel Posseth [MCP]
"GhostInAK" <gh*******@gmai l.com> schreef in bericht
news:c7******** *************** ***@news.micros oft.com... Hello Andreas,
Ah, I misunderstood as well. If yer looking for how to interrupt at form close, perhaps for the purpose of continuing the long op at the next run.. it's pretty simple.
Im the Form_QueryClose event set a varaible.. like bFormClosing to True.. Then in the loop ask the variable if the form is closing.. and if it is, exit the op. (Exit For).
-Boo
No, Ahmed I am thinking at the event of closing my form.
"Ahmed" <ah*******@gmai l.com> wrote in message news:11******** *************@m 73g2000cwd.goog legroups.com... Do you mean this:
dim iAfterLoop as integer
for i as integer =1 to 10000000
if i = something then iAfterloop = i end for end if next Ahmed andreas wrote: When I do a long calculation is there a possibility to interrupt this calculation properly?
For i as integer = 1 to 100000000 do something next and retrieve the i at the moment of the interrupting
Thanks for any response
Example
Public Class Form1
Private Mvar_Cancell As Boolean
Friend Property Cancell() As Boolean
Get
Return Mvar_Cancell
End Get
Set(ByVal value As Boolean)
Mvar_Cancell = value
End Set
End Property
Delegate Sub AsynchMethodInv oker()
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
Dim AsyncProcess As New AsynchMethodInv oker(AddressOf Me.DoSomething)
AsyncProcess.Be ginInvoke(Nothi ng, Nothing)
End Sub
Private i As Integer
Private Sub DoSomething()
For i = 1 To 100000000
'do your stuff here
If Me.Cancell Then
Exit For
End If
Next
End Sub
Private Sub Form1_FormClosi ng(ByVal sender As System.Object, ByVal e As
System.Windows. Forms.FormClosi ngEventArgs) Handles MyBase.FormClos ing
Me.Cancell = True
MsgBox("The value of i =" & i.ToString)
End Sub
End Class
regards
Michel Posseth [MCP]
"Michel Posseth [MCP]" wrote: Note that this aproach will only succeed if the loop is started with a asynchronous delegate
Otherwise the form will simply freeze untill the loop has completed and pressing the close button will result in a " This program is not responding message "
But for the rest you are right you can then set a boolean flag to jump out of the loop and let the function or a property setter return the value to the initial caller
regards
Michel Posseth [MCP] "GhostInAK" <gh*******@gmai l.com> schreef in bericht news:c7******** *************** ***@news.micros oft.com... Hello Andreas,
Ah, I misunderstood as well. If yer looking for how to interrupt at form close, perhaps for the purpose of continuing the long op at the next run.. it's pretty simple.
Im the Form_QueryClose event set a varaible.. like bFormClosing to True.. Then in the loop ask the variable if the form is closing.. and if it is, exit the op. (Exit For).
-Boo
No, Ahmed I am thinking at the event of closing my form.
"Ahmed" <ah*******@gmai l.com> wrote in message news:11******** *************@m 73g2000cwd.goog legroups.com... Do you mean this:
dim iAfterLoop as integer
for i as integer =1 to 10000000
if i = something then iAfterloop = i end for end if next Ahmed andreas wrote: > When I do a long calculation is there a possibility to interrupt > this calculation properly? > > For i as integer = 1 to 100000000 > do something > next > and retrieve the i at the moment of the interrupting > > Thanks for any response >
Hello Michel Posseth [MCP],
The loop could alternatively massage the message pump to keep a responsive
UI.
-Boo Note that this aproach will only succeed if the loop is started with a asynchronous delegate
Otherwise the form will simply freeze untill the loop has completed and pressing the close button will result in a " This program is not responding message "
But for the rest you are right you can then set a boolean flag to jump out of the loop and let the function or a property setter return the value to the initial caller
regards
Michel Posseth [MCP]
"GhostInAK" <gh*******@gmai l.com> schreef in bericht news:c7******** *************** ***@news.micros oft.com...
Hello Andreas,
Ah, I misunderstood as well. If yer looking for how to interrupt at form close, perhaps for the purpose of continuing the long op at the next run.. it's pretty simple.
Im the Form_QueryClose event set a varaible.. like bFormClosing to True.. Then in the loop ask the variable if the form is closing.. and if it is, exit the op. (Exit For).
-Boo
No, Ahmed I am thinking at the event of closing my form.
"Ahmed" <ah*******@gmai l.com> wrote in message news:11******** *************@m 73g2000cwd.goog legroups.com... Do you mean this:
dim iAfterLoop as integer
for i as integer =1 to 10000000
if i = something then iAfterloop = i end for end if next Ahmed andreas wrote: > When I do a long calculation is there a possibility to interrupt > this calculation properly? > > For i as integer = 1 to 100000000 > do something > next > and retrieve the i at the moment of the interrupting > Thanks for any response > The loop could alternatively massage the message pump to keep a responsive UI.
and so wasting proces cycles ?
However you are right it could work ,,, personally i would prefer ofcourse
my example code wich has the highest performance and is most flexible
regards
Michel Posseth [MCP]
"GhostInAK" wrote:
Hello Michel Posseth [MCP],
The loop could alternatively massage the message pump to keep a responsive UI.
-Boo
Note that this aproach will only succeed if the loop is started with a asynchronous delegate
Otherwise the form will simply freeze untill the loop has completed and pressing the close button will result in a " This program is not responding message "
But for the rest you are right you can then set a boolean flag to jump out of the loop and let the function or a property setter return the value to the initial caller
regards
Michel Posseth [MCP]
"GhostInAK" <gh*******@gmai l.com> schreef in bericht news:c7******** *************** ***@news.micros oft.com...
Hello Andreas,
Ah, I misunderstood as well. If yer looking for how to interrupt at form close, perhaps for the purpose of continuing the long op at the next run.. it's pretty simple.
Im the Form_QueryClose event set a varaible.. like bFormClosing to True.. Then in the loop ask the variable if the form is closing.. and if it is, exit the op. (Exit For).
-Boo
No, Ahmed I am thinking at the event of closing my form.
"Ahmed" <ah*******@gmai l.com> wrote in message news:11******** *************@m 73g2000cwd.goog legroups.com... > Do you mean this: > > dim iAfterLoop as integer > > for i as integer =1 to 10000000 > > if i = something then > iAfterloop = i > end for > end if > next > Ahmed > andreas wrote: >> When I do a long calculation is there a possibility to interrupt >> this calculation properly? >> >> For i as integer = 1 to 100000000 >> do something >> next >> and retrieve the i at the moment of the interrupting >> Thanks for any response >> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: androtech |
last post by:
Hello,
I'm looking for a function that returns a date range for a specified week
number of the year.
I'm not able to find functions like this anywhere. Any pointers/help would
be much appreciated.
TIA
|
by: Targa |
last post by:
Trying to total some price fields in a form but doesnt work when all the
referenced form fields dont exisit.
This is for an invoice - pulled prom a database and the form doesnt always
contain the same amount of Line Items.
If I have all 20 Line Items, it works great.
var sub1 = form.Line_Item_Subtotal1.value
var sub2 = form.Line_Item_Subtotal2.value
var sub3 = form.Line_Item_Subtotal3.value
var sub4 = form.Line_Item_Subtotal4.value
|
by: lduperval |
last post by:
Hi,
I`m trying to do date calculations in three types of time zones: local,
GMT and specified. The issue I am facing is that I need to be able to
specify a date in the proper time zone, and I`m having a heck of a time
doing so.
I have created a form where I use drop downs do specify year, month,
date, hour, minute and seconds. When the form is loaded, the dropdowns
have to display the proper values for the current time zone type. This
|
by: brian kaufmann |
last post by:
Hi,
I had sent this earlier, and would appreciate any suggestions on this.
I need to make calculations for unemployment rate for three different
data sources (A,B,C) for many countries and age groupings. The
calculation is:
unemployment rate = number of unemployed/number of labour force
|
by: John M |
last post by:
Hi,
I've been coming up against a failure of a report to display the result of a
simple calculation. I have realised that this calculation cannot take place
unless the field I am working on is displayed or is some way referred to in
the report. am I right in this? It seems odd if the field is there in the
underlying query.
Is this right? Is there a way round?
| |
by: SJM |
last post by:
There is a database which has combo boxes to allow users to select values
from pre-set lists of common specifications. The form allows users to enter
values that are not in the dropdown lists. When all input specifications are
entered the user clicks on a button which performs a series of calculations
and returns the results. It seems when the user enters values that are not
in the drop downs the calculations come back wrong, other wise...
|
by: fredrik.ryde |
last post by:
Hi,
I have a database which contains alot of finacial data. I want to
retreive some data, run som calculations with it, nothing complex just
simple arithmetic.
I wonder if it's faster to let a stored procedure to do this or is
better (faster) to just retrive the data in a simple SELECT statement
and let the application do the calculation?
|
by: Grubsy4u |
last post by:
Grubsy4u
Newbie
7 Posts October 5th, 2007
11:31 AM
#1
Report calculations
--------------------------------------------------------------------------------
|
by: Catalyst159 |
last post by:
I have a form which is used to calculate residential Floor Area Ratio (FAR). The form is structured into seven parts as follows:
Part A: Maximum FAR and Floor Area:
Part B: Gross Floor Area of the main floors of the main house:
Part C: Gross Floor Area of the basement or cellar:
Part D: Gross Floor Area of the attic:
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |