473,385 Members | 1,375 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,385 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 1237
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.