Random Access Files in VB.NET for PPC?

G

Guest

Hi All,
I would like to know how we create a Random Access Files in VB.NET
Compact Framework for the Pocket PC. I'm developing an application that will
hold Data by the User, for CRUD operations, with any no. of Random files.

I'm facing this problem of creating Random files, and need to manage
records.

Could anybody help me this issue? thanks in advance..
 
G

Guest

If I am not mistaken I don't think that you can use Random Access Files on
the compact framework.
 
P

Paul G. Tobey [eMVP]

You could always use P/Invoke and call CreateFile(), ReadFile(), WriteFile()
from the Win32 API. I don't know what the advantages of RandomAccessFile
are, but you could certainly do *something*...

Paul T.
 
G

Guest

Well, i have'nt worked on P/Invoke or the APIs yet, im going to make it a
try on PPC.. Thanks for your help guys. will let you people know how it turns
out!

--
Navin
_________________
http://ppc.itianz.com
 
K

Kay-Christian Wessel

This is of course possible without using api's.

FileStream, BinaryWriter & BinaryReader is all what you need. The Seek and
Write/ReadChars method of the BinaryReader/Writer is the only commands you
need to use.

You will need to do the handling of the record-positions yourself, but it is
done by using the Seek method..

I also use the StringBuilder for better performance.

Good luck !

Best regards
Kay-Christian Wessel
 
G

Guest

Well people, going on with all your sugg., i picked up with the
"StreamWriter" and finally able to design the Files as i needed.. Thanks.

I use the command "File.create(<filename>)" to create new files. when i
Edit/Delete the same file while the application is still running by using the
command "File.Delete(<filename>)", i get the following error :

"An unhandled exception of type 'System.UnauthorizedAccessException'
occurred in mscorlib.dll

Additional information: UnauthorizedAccessException"

But i'm able to delete the same file on restarting the Application. Am I
locking the file elsewhere or do we have an option to close the file. In
order to Edit/Delete it?
Please do help me in this issue! thnx..
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top