473,406 Members | 2,390 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Conversion from VB6 to VB.NET Architectural Question

I have an architectural issue that I have been working on for quite awhile
now and I would like another person's point of view. This issue involves the
conversion of a VB6 app to VB.NET.

In this VB6 app, the original programmer used 5 timers to periodically scan
a document, process it, and display thumbnail images of the scanned
document. These 5 timers implement 5 different subroutines that enable this
process. In my conversion of this app to VB.NET, I have investigated and
implemented threads, threadpools, timers, and now async delegates with
varying degrees of success (in regards to application performance.)

What I am trying to do is to try to simulate the original VB6 timers (that
implement the 5 different routines) to the new .NET approach as follows:

Original New
VB6 App VB.NET App
-------------------------------------------
Timer 1 Main Threading Timer - (Encapsulates Threadpools 2 thru 5)
Timer 2 Threadpool 1 - (Scans document)
Timer 3 Threadpool 2 - (Executes another program as a process for
image character recognition)
Timer 4 Thread pool 3 - Display Thumbnail images
Timer 5 Threadpool 4 - Exits after the above Threadpools are done

This worked but was so CPU intensive that it did not allow me to implement
other features. For example, once the app started running, it was polling
the scanner so much that the UI did not allow me select the scanned bitmap
images to expand them. When I varied the Threading Timer values, I was able
to expand the bitmap images but it was still very slow. I understand that
win forms are not thread safe and I did implement the code necessary (ie.
invoke required...etc.).

I understand that using Async delegates can also do the polling necessary
and some have stated that it is "cleaner" than using Timers and Threadpools
in this case. Architecturally speaking, what would be the best way to have
this converted to VB.NET and still have the same functionality and
responsiveness?? What other approach would I use other than what I have
described?? Since responsiveness is the key, is using Async delegates a
viable option??
Thanks so much in advance!
Viet



Nov 21 '05 #1
2 1238
Sorry cant be of much help architecturaly but here are my 2 cents.

Did you consider using one of the many Timers available in .NET just to make
sure that your app gets going atleast for the time being.

One more thing, u mentioned "when I varied the Threading Timer values", what
exactly do you mean by this. I assume your are using Sleep to make the
polling wait for a while.

HTH
rawCoder

"Viet" <vp**@starcalif.com> wrote in message
news:Ob**************@TK2MSFTNGP12.phx.gbl...
I have an architectural issue that I have been working on for quite awhile
now and I would like another person's point of view. This issue involves the conversion of a VB6 app to VB.NET.

In this VB6 app, the original programmer used 5 timers to periodically scan a document, process it, and display thumbnail images of the scanned
document. These 5 timers implement 5 different subroutines that enable this process. In my conversion of this app to VB.NET, I have investigated and
implemented threads, threadpools, timers, and now async delegates with
varying degrees of success (in regards to application performance.)

What I am trying to do is to try to simulate the original VB6 timers (that
implement the 5 different routines) to the new .NET approach as follows:

Original New
VB6 App VB.NET App
-------------------------------------------
Timer 1 Main Threading Timer - (Encapsulates Threadpools 2 thru 5) Timer 2 Threadpool 1 - (Scans document)
Timer 3 Threadpool 2 - (Executes another program as a process for image character recognition)
Timer 4 Thread pool 3 - Display Thumbnail images
Timer 5 Threadpool 4 - Exits after the above Threadpools are done
This worked but was so CPU intensive that it did not allow me to implement
other features. For example, once the app started running, it was polling
the scanner so much that the UI did not allow me select the scanned bitmap
images to expand them. When I varied the Threading Timer values, I was able to expand the bitmap images but it was still very slow. I understand that
win forms are not thread safe and I did implement the code necessary (ie.
invoke required...etc.).

I understand that using Async delegates can also do the polling necessary
and some have stated that it is "cleaner" than using Timers and Threadpools in this case. Architecturally speaking, what would be the best way to have
this converted to VB.NET and still have the same functionality and
responsiveness?? What other approach would I use other than what I have
described?? Since responsiveness is the key, is using Async delegates a
viable option??
Thanks so much in advance!
Viet


Nov 21 '05 #2
Rawcoder,
Thanks for your reply. I have considered the many Timers available in .NET
but the problem that I was having was that once the app started executing
with the timer, it was difficult to do other things since the timer was
taking a majority of the CPU time (due to all the polling). I considered
executing the timer as a different Thread but I still needed to keep the
constant scanner polling functionality and hence my problem: how to keep the
scanner constantly polling but still keep the app UI responsive to user
demands without loss of responsiveness. I know that there has to be a way
since alot of apps implement this multitasking feature.

In regards to the second paragraph, my original code for the threading timer
was as follows:

Dim stateTimer As System.Threading.Timer = New
System.Threading.Timer(timerDelegate, evt, TimeSpan.FromSeconds(3),
TimeSpan.FromSeconds(5))

By changing the values, one can determine how fast or how slow polling can
be.

The answer is probably something simple that I am overlooking or something
that I am implementing incorrectly in current design.

Thanks,
Viet


"rawCoder" <ra******@hotmail.com> wrote in message
news:uV**************@TK2MSFTNGP10.phx.gbl...
Sorry cant be of much help architecturaly but here are my 2 cents.

Did you consider using one of the many Timers available in .NET just to make sure that your app gets going atleast for the time being.

One more thing, u mentioned "when I varied the Threading Timer values", what exactly do you mean by this. I assume your are using Sleep to make the
polling wait for a while.

HTH
rawCoder

"Viet" <vp**@starcalif.com> wrote in message
news:Ob**************@TK2MSFTNGP12.phx.gbl...
I have an architectural issue that I have been working on for quite awhile now and I would like another person's point of view. This issue involves the
conversion of a VB6 app to VB.NET.

In this VB6 app, the original programmer used 5 timers to periodically

scan
a document, process it, and display thumbnail images of the scanned
document. These 5 timers implement 5 different subroutines that enable

this
process. In my conversion of this app to VB.NET, I have investigated and
implemented threads, threadpools, timers, and now async delegates with
varying degrees of success (in regards to application performance.)

What I am trying to do is to try to simulate the original VB6 timers (that implement the 5 different routines) to the new .NET approach as follows:

Original New
VB6 App VB.NET App
-------------------------------------------
Timer 1 Main Threading Timer - (Encapsulates Threadpools 2 thru 5)
Timer 2 Threadpool 1 - (Scans document)
Timer 3 Threadpool 2 - (Executes another program as a process

for
image character recognition)
Timer 4 Thread pool 3 - Display Thumbnail images
Timer 5 Threadpool 4 - Exits after the above Threadpools are

done

This worked but was so CPU intensive that it did not allow me to

implement other features. For example, once the app started running, it was polling the scanner so much that the UI did not allow me select the scanned bitmap images to expand them. When I varied the Threading Timer values, I was

able
to expand the bitmap images but it was still very slow. I understand that win forms are not thread safe and I did implement the code necessary (ie. invoke required...etc.).

I understand that using Async delegates can also do the polling necessary and some have stated that it is "cleaner" than using Timers and

Threadpools
in this case. Architecturally speaking, what would be the best way to have this converted to VB.NET and still have the same functionality and
responsiveness?? What other approach would I use other than what I have
described?? Since responsiveness is the key, is using Async delegates a
viable option??
Thanks so much in advance!
Viet



Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Russell Reagan | last post by:
In a newer version of a chess program I am writing, I have created classes that are (more or less) drop in replacements for things that used to be plain old integer or enumerated variables (colors,...
5
by: Vijai Kalyan | last post by:
Hello, I have come back to C++ after a couple of years with Java so I am quite rusty and this question may seem poor: My platform is Windows XP with MSVC 7.1. I have a class with a...
26
by: David W. Fenton | last post by:
A client is panicking about their large Access application, which has been running smoothly with 100s of thousands of records for quite some time. They have a big project in the next year that will...
31
by: Bjørn Augestad | last post by:
Below is a program which converts a double to an integer in two different ways, giving me two different values for the int. The basic expression is 1.0 / (1.0 * 365.0) which should be 365, but one...
2
by: Alex Sedow | last post by:
Why explicit conversion from SomeType* to IntPtr is not ambiguous (according to standart)? Example: // System.IntPtr class IntPtr { public static explicit System.IntPtr (int); public...
3
by: clintonG | last post by:
From page 3 of "Personalization in ASP.NET" I don't fully understand how to convert the signature of the following code snippet or the ASP.HttpProfile assignment which follows... Sub...
0
by: clintonG | last post by:
I've attempted to post this message twice already today. It has yet to appear so I am trying again... From page 3 of "Personalization in ASP.NET" I don't fully understand how to convert the...
47
by: rawCoder | last post by:
Hi, Just wanted to know if there is any speed difference between VB conversion Keywords like CInt, Clng, CStr, CDbl, CBool etc. ..NETs Convert.To<...> methods. And which is better to be...
21
by: REH | last post by:
It it permissible to use the constructor style cast with primitives such as "unsigned long"? One of my compilers accepts this syntax, the other does not. The failing one chokes on the fact that the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...
0
jinu1996
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.