How To Read Existing VB 6 Random Access Files

Oct 30, 2010

I have 15 years' worth of files (approx. 10,000) that were created using VB6 structures and stored using the random access method. I am trying to write a conversion routine that will read the old structures and put them into a new format that is more compatible with the .net environment. I have not been able to successfully read any of the old files using the tools available in .net. Each file starts with a header record structure. The header record tells me how many tags are in the file. The next record (ie record number 2) is the first tag pointer record in the file.

There are num_of_tags of the pointer records. Each pointer record has the string that holds the tag's 'literal name and two long integers that tell where in the file this tags records are. Those actual records are stored as History data structures, [Code]

View 10 Replies


ADVERTISEMENT

Will VS 2010 Express Read, Write To Random Access Files

Apr 19, 2011

I have recently decided to give .net another chance, but i have a few questions about it before i get really into it. RE: Files, I use random access files to store data as opposed to databases (namely i don't see the need for a database for storing so little information(records <200 max) knowing that it is an older system and less "cool" i don't care...) Will vs2010 express read, write to random access files? Would it be done kind of like vb6 (which is my current vb version)? I will be needing to print the text of rich text boxes, is vs2010 express capable of doing this?

View 7 Replies

Random Access - Read Data From A Form A Save It Into A .dat File?

Feb 24, 2010

This time, basically, i'm working with Random Access Files.I have this et of code to read data from a form a save it into a .dat file. This works fine.

Public Class frmDramaClub
Structure MemberRecord
Dim ID As Integer[code].....

View 5 Replies

Converting VB5 To VB2010 - Random Access Files?

Jul 27, 2011

I am trying to convert a VB5 program to VB2010 so that I can continue to support it on my new PC. My copy of VB5 was an upgrade from VB3 which was an upgrade from VB2 which came on floppies, so I can't just install every preceding version as my new PC doesn't have a floppy drive.I have accepted that I will have to design all the forms from scratch (whatever happened to twips?) and will have to go through the thousands of lines of code line-by-line, but I have hit a brick wall when it comes to random access files. One such file is defined in the Declarations section of Module1 thus:[code]....

I soon found I had to change Type to Structure, but then in the declaration of transrec, transtype acquired a wavy blue underline with the error message: "'transrec' cannot expose type 'transtype' in namespace 'Treasurer_2010' through module 'Module1'.So if I can't use the structure in the module in which it is declared, where can I use it?

View 4 Replies

File I/O And Registry :: Random Access Files In .NET?

Nov 2, 2009

how to read and write random access records in .NET. Now I know random access files are dead and the response on every query I found with google/bing/yahoo searches was don't use random access use Binary serialization but I can not. I have a situation where I need to read and modify 256 byte records in a file that is used by another application.

Now for a bit of background the file is made up of 27 fixed length records of 256 bytes. Each of the records has a separate structure consisting of 30-120 fields. The proplem I am having is I can create the record structures but when using the FileGet method I am receiving an error. Now I have found samples that showed the same format I am using that claim to work.

The error I am getting is Option Strict On disallows narrowing from type 'System.ValueType' to type 'ProgramName.ModuleName.Record' in copying the value of 'ByRef' paramater 'Value' back to the matching argument.

The basic layout (simplified) is as follows:

Code:
Structure Record
<VBFixedString(6)> Public SomeParam as String
Public SomeNumber as Short

[Code]....

Now the overloads for FileGet show all of the data types including Object. But I have tried various methods to retreive the 256 byte record but without success. Do I have to actually read each of the several hundred fields of the structure one by one? Or am i overlooking something (I have been known for this in the past)

Or (and I'll kick myself if this is the only way) do I just have to set option strict Off in the module and the code as above will actually work.

I would love to be able to just ditch the random access file but I have to keep it for compatibility with several other applications at this time.

View 14 Replies

Save Data To Random Access Files?

Sep 6, 2010

how do you save data stored in an array of records (structure) to a text file using StreamWriter? I currently have

Private Sub btnSaveToFile_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSaveToFile.Click
Dim sw As New StreamWriter(New FileStream("EmployeeDetails.txt", FileMode.Create, FileAccess.Write))
For Each record As EmployeeType In employees

[code]....

but it doesn't work. My array is fixed and currently has 3 elements (for testing purposes). If I enter two records and add these to the structure I get the following data saved to the text file:

123,helen,66000
879,john,89975
0,,0

How do I stop unused elements of the array being included when writing to file? Should I use a dynamic array instead and if yes, how do you use dynamic arrays with structures?

View 1 Replies

Converting Quick BASIC To VB - Random Access Files

Jan 16, 2012

I'm trying to convert an old Quick BASIC program to VB.Net. There doesn't appear to be any direct replacement for the old file statements. Building a database seems like overkill for my simple needs.

How can I do the following in VB.Net?

OPEN "test.dat" FOR RANDOM AS #1 LEN = 20
FIELD #1, 10 AS a$, 10 AS b$
LSET a$ = "One"
LSET b$ = "Two"
PUT #1, 1
GET #1, 1
PRINT a$, b$
CLOSE #1

View 1 Replies

Random Access Files - Lengthen The String (or Even If It's Longer Than 3 To Begin With)?

Jan 24, 2009

I'm working with random access files. I created a module and in it put the

Structure PersonData
Dim Name as String
Dim Age as Integer[code]....

The problem is strange... it will let me input string lengths of 3 for Person.Name and Person.Description and it will save correctly, however, the moment I try and lengthen the string (or even if it's longer than 3 to begin with), I get a 'bad record number' error.

View 2 Replies

MS VS(vb) '08 Express Include External Files For Read/write Access?

Dec 2, 2009

I am using Visual Basic 2008 Express Edition. Some of the programs I am writing make extensive use of External files (saved games, data, item lists, etc.) I could use an easy way to get these files to ride allong during deployment (cd mostly). adding them to the resources works for some static pictures, but custom structures into lists of info to read and write from are beond that features abilities, same with the settings feature. I have found in other help referance to "MageUI.exe" so is downloading a .net SDK my solution or is there a better trick I can use?

View 2 Replies

How To Add To An Existing Random File

Jan 19, 2010

Im creating a login system that allows staff to clock in using a 5 digit code. Staff members can also use the "add an employee" function to add a new employee to the Random File.The problem is, everytime i try to create a new employee and hit the save button, the new record writes over the existing records, one by one, everytime the programme is stopped and started up again.

My Question is: How can i get the new record to be saved, without deleting existing records,

Here is the save buttons click method:FileOpen(fileNumber, "C:employee.dat", OpenMode.Random, OpenAccess.Write) 'open the file with Write Access
myEmployee.name = txtNewName.Text 'adds the name
myEmployee.id = txtNewID.Text 'adds the ID
FilePut(fileNumber, myEmployee, n) 'save to the file
FileClose(fileNumber)

View 2 Replies

Read A .dat File Into An Existing Sql Database?

Oct 26, 2009

I have a series of .DAT files I need to read into vb.net and then parse the data into a format that can be easily read into an SQL database that already exists. Would I be using a StreamReader object? Or is there a different way to go about this?

View 11 Replies

DataGridView Column Read Only For Existing Records

Dec 9, 2009

I have a datagridview that is bound to a dataset by dragging it onto a windows form. I want one of the columns on the datagridview to be read only for existing records (rows), but I don't want it read only when the add new icon is pressed on the navigator. How can I tell when a row is being edited as opposed to being added?

View 2 Replies

Read All Existing Text File Continuously?

Jan 18, 2012

how to read multiple text files in a folder continuously..

example:..

In a folder i have a few of text files such as

sensor.20120101.txt
sensor.20120102.txt
sensor.20120103.txt
sensor.2012010.......txt

..So how to write vb coding to read all text file continuously...how to declare

View 4 Replies

How To Rename Existing Files

Sep 23, 2010

This is what I've wrote.. and it fails to rename existing files
For Each file As String In listbox1.Items
IO.File.Copy(file, IO.Path.Combine(fbCopyto.SelectedPath, IO.Path.GetFileName(file)))
While IO.File.Exists(fbCopyto.SelectedPath & file)
file= file & x & ".wav"
x += 1
End While
Next

View 4 Replies

Print Multiple Existing Files - PDFs

Feb 23, 2009

I need to print multiple existing files, PDFs. I have the following

[Code]....

Is there another 'better' way of doing this? Sometimes it just doesn't print the PDF, I guess because it's taking longer than the WaitForExit time. And so closes the process.

View 2 Replies

Update Existing Folder With New Updated Files?

Jul 6, 2009

im having a problem with replacing some files in a folder, i have made a Auto Upater for a application im making (so beta testers can test it and also get updated stuff to test) now i can replace the Main application.exe with

If File.Exists(Application.StartupPath + "\test.exe") Then
File.Replace(Application.StartupPath + "\update\test.exe", Application.StartupPath + "\test.exe", Application.StartupPath + "\test.exe.old")
End If

This is after i have unziped the main update.zip folder it downloaded

but i also have a Data folder in the Main application folder and inside the new update\Data folder its has updated files now i cant list all files to replace like above as i want be replacing all files all the time, so im looking for something like you have on windows (would you like to replace files) without the prompt its just replaces them, so really im looking for a move and replace without prompting

i have tryed

Directory.Move(Application.StartupPath + "\update\Data", Application.StartupPath + "\Data")

and

Directory.Move(Application.StartupPath + "\update\Data\", Application.StartupPath + "\Data\")

but it errors saying the folder exists and i cant delete the folder as it will have files in that DONT need updating

View 2 Replies

Combine Multiple Files Into An Existing Excel Sheet?

Jan 19, 2012

I've programmed a vb.net application. This is a matching applcation generates 3 lisboxes. I have written these to a csv files. [code]...

View 3 Replies

VS 2008 - Open Existing Text Files And Create New Ones

Sep 4, 2010

I am currently writing a program in VB 2008. Here is what the program is intended to do: I need it to have two forms of input, so I want it to open existing text files and create new ones. Once the user has selected what input to be taken (either a file is opened or a new one is made, guessing multiple forms need to be used here) the user will then take the text file either created or opened and then be able to click a button which will sort all the text in the text file into alphabetical order and then display the results to the screen. While this happens, I need the words in the file to be counted by a counter (so a loop i guess) that then displays on which line each word appears on. I then need this information to be displayed in a text box on screen.

View 2 Replies

VS 2008 ITextSharp - Adding Watermarks To Existing PDF Files

Dec 16, 2009

I am using iTextSharp to add watermarks to existing PDF files & using PDF-XChange Viewer [URL] to view & print the PDF's. The problem is that the watermarks don't display in PDFXC & print out with the spacing all messed up. Is there a certain way I need to create the watermark with iTextSharp in order for it to display in PDFXC?

View 3 Replies

Run Existing Access Queries?

Jun 28, 2010

is there a way to run a query that already exists in an access database?

View 22 Replies

Random Read From Text File?

Jan 21, 2010

Im reading User/Pass from a text file. It has multiple user/passes in it and I want it to randomly select one to use. How would i do this? Here is the code im using now

Using parser2 As New TextFieldParser(filename2)
parser2.SetDelimiters(delimiter2)
While Not parser2.EndOfData

[Code].....

View 2 Replies

Random Text In Serial Read?

Feb 1, 2012

im reading a serial com port (Ardunio FTDI presented as a com anyway). It works fine for a few seconds then randomly I get random text, Ive tried a few different settings but there dosnt seam to be a specific trigger for the randomness.Ive read a few notes about a known buffer overflow issue and checked it in terminal where it's fine. This is my first return to VB in 10? years so im more then alittle rusty but this has me stumped,

Private Sub Timer2_Tick(sender As System.Object, e As System.EventArgs)
Handles Timer2.Tick
Dim LineOfText As String[code].....

View 3 Replies

Read A Random Line From Txt File?

Sep 8, 2011

I have this to read a random line from a .txt file[[code]....

View 3 Replies

Read A Random Lines From A 2 RichTextBoxes?

May 12, 2012

As the title shows I'm trying to to read a random line from a RichTextBox. It should be as follows:

User loads a list with firstnames a RichTextBox. User loads a list with Lastnames in a RichTextBox. Then it needs to read one random line from firstNameBox and a random line from LastNameBox into 2 strings. When the user clicks on genarate name. A random First and last name will be showed in a textbox.

View 9 Replies

Access An Existing Textbox Using Threading?

Jun 21, 2010

how to access an existing textbox using threading..i need it for auto complete functionality...

View 3 Replies

Add A New Column To An Existing Access Table?

Nov 20, 2010

What I want to do is add a new column to an existing access table which I have already created using the code below.

'Define the connectors
Dim oConn As OleDbConnection
Dim oCo

[code].....

View 6 Replies

Add Record To Existing Access 2007 DB

Aug 4, 2011

Add new row to Access 2007 DB.I am trying to add a new row to a access db. I receive the error update requires a valid insertcommand.when passed datarow collection with new rows when Cmd.update(my_table).[code]

View 1 Replies

Write - Save - Read .txt Files (or Html Files)

Mar 14, 2011

I want to develop an application which can Write, Save, Read text files(or html files) What I want the application to do is. When I open my application I can write stuffs and then it will save it to my hosting/server. Then, the application will read the text which I already save.. So far, I can only make the application read it by using WebBrowser control and navigating it to a specified URL. Example: [URL](or message.txt) Which I modified from the website not from the application. I want to modify the text or html files from my application.

View 6 Replies

Read Data (read Only) From Excel Files?

May 27, 2011

I want to read data (read only) from excel files

I use this connection string

Con_BarCode = New ADODB.Connection
With Con_BarCode
.ConnectionString = "Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm,

[Code].....

View 1 Replies

2008 - Access Denied Or Not Existing Directories

Nov 21, 2009

I have this small file search engine here made in VB.NET:

ListBox1.Items.Clear()
ListBox3.Items.Clear()
ChDir("C:")
Try

[code]....

It searches through your whole C: for the file you entered. Although the problem I get is that some directories get access denied or not existing directories.

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved