I have converted a VB6 app to VB.NET. It's function is to generate
reports from a Random Access file but the .NET version is pathetically
slow compared to the VB6 version.
I think I need to to get the FileStream class to work with Random Access
Files, but it requires the data Structures to be in a byte array. How
do I convert them?
S. 13 2542
Hi Stuart,
Do you have Option Strict On in top of your program, maybe it is slow
because of the late binding.
I would try to set that if it is not..
Cor I have converted a VB6 app to VB.NET. It's function is to generate reports from a Random Access file but the .NET version is pathetically slow compared to the VB6 version.
I think I need to to get the FileStream class to work with Random Access Files, but it requires the data Structures to be in a byte array. How do I convert them?
Cor wrote: Hi Stuart,
Do you have Option Strict On in top of your program, maybe it is slow because of the late binding.
I would try to set that if it is not..
Cor
Option Strict is off.
I have read that you shouldn't use VB's "FileOpen" method to access
files, and use the System.IO.Stream.... class instead, as it's much
faster. I have used FileStream where I can, but I can't get Random
Access files to work with it, due to the Byte Array requirement.
A report I run in my vb6 app takes 11 seconds. In .Net it's talking 51
seconds!
S.
Hi Stuart,
Why not set option Strict on and look what castings you have to add.
Probably you get a much higher performance.
Cor
Cor wrote: Hi Stuart,
Why not set option Strict on and look what castings you have to add.
Probably you get a much higher performance.
Cor
Doesn't anyone use Random Access files anymore? They are a great way to
store large volumes of fixed length data. Very fast in VB6, QuickBasic,
and Powerbasic. But in .Net it seems to be hopelessly slow. 463% slower
in my case!
S.
Did you set option strict on as I asked?
A lot of things are with option strict off much slower so that can be
normal.
Cor Hi Stuart,
Why not set option Strict on and look what castings you have to add.
Probably you get a much higher performance.
Cor
Doesn't anyone use Random Access files anymore? They are a great way to store large volumes of fixed length data. Very fast in VB6, QuickBasic, and Powerbasic. But in .Net it seems to be hopelessly slow. 463% slower in my case!
S.
Hi,
Maybe this will help. http://www.devx.com/dotnet/Article/6971/5
Ken
------------------------
"Stuart" <st****@stu.org.uk> wrote in message
news:c0*************@ID-17980.news.uni-berlin.de... I have converted a VB6 app to VB.NET. It's function is to generate reports from a Random Access file but the .NET version is pathetically slow compared to the VB6 version.
I think I need to to get the FileStream class to work with Random Access Files, but it requires the data Structures to be in a byte array. How do I convert them?
S.
"Stuart" <st****@stu.org.uk> schrieb Why not set option Strict on and look what castings you have to add.
Probably you get a much higher performance.
Doesn't anyone use Random Access files anymore? They are a great way to store large volumes of fixed length data. Very fast in VB6, QuickBasic, and Powerbasic. But in .Net it seems to be hopelessly slow. 463% slower in my case!
Did you try Cor's suggestion?
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
Cor wrote: Did you set option strict on as I asked?
I tried switching it on, but it won't compile on the FileGet
FileGet(FileCh, MyStructure, MyPointer)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VB complains at every element of the structure. Yet of I switch off
Option Strict, it compiles, and runs.
Thanks,
Stuart.
"Stuart" <st****@stu.org.uk> schrieb Cor wrote:
Did you set option strict on as I asked?
I tried switching it on, but it won't compile on the FileGet
FileGet(FileCh, MyStructure, MyPointer) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VB complains at every element of the structure.
Do you know the reason why it complains?
Yet of I switch off Option Strict, it compiles, and runs.
Yes, did you wonder why it runs? What is done in the background if it runs?
This may slow down your code.
--
Armin
How to quote and why: http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
> Do you know the reason why it complains?
For each element of my structure, it says something like
Value of type cannot be converted to Double
Value of type cannot be converted to Integer
etc.... Yet of I switch off Option Strict, it compiles, and runs.
Yes, did you wonder why it runs? What is done in the background if it runs? This may slow down your code.
I take your point. But what do you convert a structure too to satisfy
the compiler?
Stuart.
Hi Stuart,
That is the trouble, you have to cast it give it in advance the right type
and not let it find that out at runtime everytime the code uses it.
We agree that that what I now am writting should be standard or a kind of
automatic word processing, but it is not, but I have heard that they intent
to do this in the next version of VB.net.
When it says it has to be a string, you mostly can add after it .ToString
When it say it has to be a double you can set before it Cdbl(xxx)
When it says it has to be a Integer you can set before it Cint(xxxx)
When it is a reference type and it is the same type of object you mostly can
do
directcast (x, y) as sample a textbox derives from controls, and therefore
you can say
directcast (x, textbox).lines when you know that the object you get is a
textbox.
I hope this helps a little bit?
Cor Value of type cannot be converted to Double Value of type cannot be converted to Integer etc....
Yet of I switch off Option Strict, it compiles, and runs.
"Stuart" <st****@stu.org.uk> schrieb Do you know the reason why it complains?
For each element of my structure, it says something like
Value of type cannot be converted to Double Value of type cannot be converted to Integer etc....
Yet of I switch off Option Strict, it compiles, and runs.
Yes, did you wonder why it runs? What is done in the background if it runs? This may slow down your code.
I take your point. But what do you convert a structure too to satisfy the compiler?
Ok, I got it now. With Option strict off, you can pass the structure object
but you would get an exception if a different type would be returned. Option
Strict On prevents you from getting this error at run time.
The other thing is that VB won't return the wrong object, but the compiler
can not know this.
If you enable option strict, you'd have to read each structure member on
your own. Maybe in this case you could put the fileget statement into a
Class/Module that has "option strict off" at it's top (I can't believe I
write this....but this seems to be an exception of the rule), so option
strict is limited to the module and does not affect the whole project.
--
Armin
Hi Armin, If you enable option strict, you'd have to read each structure member on your own. Maybe in this case you could put the fileget statement into a Class/Module that has "option strict off" at it's top (I can't believe I write this....but this seems to be an exception of the rule), so option strict is limited to the module and does not affect the whole project.
I think that is not the good approach, I will real advice you Armin to set
always Option Strict On in your programs.
This is not for you Stuart, you can do what Armin say, for the time beeing
it is a solution.
Cor This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Bruno Barberi Gnecco |
last post by:
I'm developing a collaborative application in PHP which accesses
local files and may modify them. How can I synchronize the multiple
accesses? Note that I'm not worried about the algorithmic part...
|
by: ddsvi78 |
last post by:
I am a complete idiot when it comes to access. Now that said, I work
for a computer security company and one of our customers came to us
with an access problem.
They had been running fine for a...
|
by: Cybertof |
last post by:
Hello,
Is there a simple way to read a random access file that has been created
with VB6 using direct writing to disk of Type....End Type structures ?
I have not found this possibility in C#.
...
|
by: Raterus |
last post by:
I'm just throwing this error out for my sanity, I've seen posts about this, but never solutions.
I'm using VS.NET 2003, Framework 1.1, and I'm getting a random error about every 1 out of 10 times...
|
by: Simon |
last post by:
This problem has been driving me mad for months.... Seen a few posts on
forums about it but no answers... No mention on MSDN etc.
XP Pro SP1, VS.NET (c#) .Net framework 1.1, IIS 5.1. In a...
|
by: kaminekutte |
last post by:
Hi everybody,
I have been trying to parse a 100MB log file(tab separated). Basic aim is to read the file randomly, do some procesing and then display the contents of the file line by line. Working...
|
by: howa |
last post by:
for example, there are 10K files in the directory,
given that i don't know if files name, is it possible to fetch a file
randomly?
thanks.
|
by: Alan Isaac |
last post by:
This may seem very strange, but it is true.
If I delete a .pyc file, my program executes with a different state!
In a single directory I have
module1 and module2.
module1 imports random and...
|
by: Arno R |
last post by:
Hi all,
So I bought a new laptop 10 days ago to test my apps with Vista. (home premium)
Apparently Office 2007 is pre-installed. (a time limited but complete test version, no SP1)
So I take the...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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...
|
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...
|
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: 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...
| |