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


ADVERTISEMENT

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

Upgrade From Quick Basic On XP?

Nov 12, 2009

I used to write programs in Quick Basic on my XP computer. I now have a Vista (64bit) computer and everybody knows (except me) that those programs won't run on my Vista computer.I want to be able to write single user programs on my Vista computer like I did with my XP computer. Since I'm somewhat familiar with the Quick Basic language, I want to stay in the "Basic" language family. What do I need to have on my Vista computer that would allow me to write and run simple single user programs?

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

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

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

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

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

Creating And Updating Ms Access Mdb Files With Visual Basic?

Feb 27, 2010

how can i create and update mdb [ access ] files in visual basic 2008..and also if i have a dll library how can i get all of its syntax for using it in visual basic?

View 2 Replies

Reading Access Database Files Directly Into Visual Basic?

May 6, 2010

I would like to be able to read a column of numbers from an Access database into a VB.NET program and then manipulate that data.For example I have a column of numbers and want to add them up and then take the averageThe maths is not a problem but how do I read the column of data into the program. I know how to do this if I first export the Access data into a CSV file, but

View 11 Replies

Quick Find And Quick Replace Dialog Windows For 2008 IDE?

Dec 7, 2010

I am developing a VB application using the Visual Studio 2008 IDE. I was making changes to my code using the Quick Replace function when the dialog window stopped displaying. Selection of Quick Find or Quick Replace from the Edit menu, as well as use of shortcut keys (CTL+F and CTL+H) all have the same affect: the IDE loses focus but no dialog windows display. Is this a known issue with an available fix?

View 1 Replies

Converting File Into Bytes And Then Converting Those Files Back Into Its Original Form?

Aug 22, 2011

my goal is to

1.Take an file(exe,dll,etc)

2.Convert it into hex

3.place that hex values in a stack

4.Execute the values inside the stack to its original form(i.e. take the elements out of stack and then convert it to a compile format)

Imports System.IO
Sub Main()
Dim fileName As String = "ABC.exe"

[code]....

View 1 Replies

DB/Reporting :: Searching For More Effective Data Storage For Quick Access?

May 12, 2008

I am quite green to VB .NET and it start occuring to me that I am doing things probably in a very ineffective way.Anyway here is the problem I have datasets, consisting of integers there is set 1 which is of format ID, ID2 - ID here is unique but different ID can refer to same ID2. Before I start reading in the data I have unknown number of these entries (ID and ID2 can be at least as high as 99999999)

Then I have a second data set of format ID2 here is the same as in the set 1 and it can contain several PID entries (all integers). In this set the ID2 is unique and again for one ID2 there can be unknown amount of these PIDs, same PID can occur more than once.

[Code]...

View 17 Replies

Converting MINI-BASIC Over To .NET?

Mar 9, 2009

Would it be an easy task to convert MINI-BASIC, written using MASM, on over to VB.NET?Here is the Yahoo Groups page for MINI-BASIC: [URL] MINI-BASIC is a modern variation on the old Tiny BASIC language from 1976.

View 17 Replies

Converting Javascript Code To Visual Basic?

May 4, 2009

I�ve tried a verity of different things but I can�t seem to find something that works so I thought I would Ask here, if This is the wrong place then Sorry If you could point me to the correct place the I would Post there. Now I have this JavaScript code that I want to get working in a VB.Net Client side application?

function send_request() {
if (window.XMLHttpRequest) { // Mozilla, Safari, ...
http_request = new XMLHttpRequest();

[code]....

View 1 Replies

Get The Vb Random Function - Basic Winapp Application

May 13, 2010

I must say I don't get the vb Random function. Try making a basic winapp application, but a button named Button1 and a few (around 10) labels on the form. Then add the following to the forms codebehind:

Code:
Public Class Form1

Public Function RollDize(ByVal iDize As Integer) As Integer

Dim iRes As Integer

[CODE]...

Now, if you click the button, you will see that all the labels get the same number. However, if you step through the code in debug, the numbers are random.

View 6 Replies

Getting A Random Number In MS Visual Basic 2008?

Sep 1, 2011

I am currently enrolled in the class. My final project for the class will generate random numbers within a range of numbers. For example, if I give the user five text windows to choose whether to input a number OR generate a random number, I will have a button called RANDOMIZE. Unfortunately, I do not know the line(s) of code for the random function.

View 2 Replies

Random Selection Of Categories Without Replacement In Visual Basic

Sep 5, 2011

Here's the program. there are five categories say a, b, c, d, e, each in a textbox (color blue). There will be a command button say "choose". If i click the choose button, it will randomly choose one category and that corresponding textbox example "a" will change color(color yellow). Then if I want to click the choose button again, the selected category "a" from the first selection will change to gray, then a new category will be randomly chosen without "a" in the list and again will change to color yellow. and so on. So I can click the choose button five times, exhausting the five categories without repeating the category that was already selected.

View 6 Replies

Converting Visual Basic Parallel Port App Using Inpout32.dll In To Delphi?

Nov 23, 2011

I've been given this simple VB application and library which I'm told can open a door/turnstyle attached to the printer port at 0x378 base address.'Inp and Out declarations for port I/O using inpout32.dll.

Public Declare Function Inp Lib "inpout32.dll" Alias "Inp32" _
(ByVal PortAddress As Integer) _
As Integer

[code]....

how to declare the library functions and what to declare the variables as (&H378 is obviously not an integer)

View 2 Replies

Visual Basic 2008 Exspress Edition Random Feezes And Crashed?

Aug 19, 2011

Im kind of wondering can I fix this? When I edit code in Visual Basic 2008 Exspress Edition it will everytime open after maybe 15 to 30 mins feeze and close, sometimes it unfreezes but not always

View 2 Replies

C# - Converting Video Files To .flv Files

Jul 7, 2009

I am having a problem with converting video files to .flv files. I am using ffmpeg.exe tool to achieve this. Here on my local server when I use ffmpeg.exe tool with c# code everything is working good. But when I deploy the same code with ffmpeg tool on to my hosting server, where as .exe files are not allowed to execute, the code is not running. Is there any other way to achieve the same other than redirecting to video conversion sites because I want to save .flv files on my hosting server.

View 3 Replies

Converting .bas Files From VB 6.0 - Project

Nov 4, 2009

I have my project in which i have many .bas files and now i want to convert the project into VB.NET. The vbp files are directly converted by Visual Studio 2005 but .bas files are not being converted.

View 2 Replies

Converting Files Without An Extension?

Feb 14, 2011

I'm at present looking at various ways on how to convert files without any extension and making them with a .txt extension. At present, I'm using the RENAME feature within windows to do this, but i takes time when there are a lot of files to rename. Can anybody give me a few pointers on how this can be done using Visual Basic?

View 3 Replies

Converting A User Generated List Box To An Array And Then Generating A User Defined Number Of Random Strings And Placing It In A Textbox?

Apr 28, 2007

I'm converting a user generated list box to an array and then generating a user defined number of random strings and placing it in a textbox.The code I have works fine as it will generate the number of random strings the user wants, except sometimes a line is blank at the top of the list but is counted as a string.

View 4 Replies

[2005] Writing Random Files Name

Jan 5, 2009

I am writing the source code to write the random files name but I don't know how to write that in vb.net Here it is the

[Code]...

View 30 Replies

Database - Visual Basic: Copying A Random Row From One Table Into Another Table At Runtime

May 16, 2011

I have a database that has two tables in it. One is a table of items (table1) and the other is the table of current items (table2).On form load I need to generate a random amount of the items from table1 and populate table2 with them. I was trying to do something like this:

[Code]...

View 2 Replies

.Net Framework 4.0 - Update Random Data Files

Apr 13, 2011

I have a VB 6.0 application that works with random data files... Now I have to create a .Net 4.0 application that generates and update random data files.... Net Framework 4.0 can work with random data files ? Does it support again this old tecnology ?

View 1 Replies

Converting From Access To SQL

Apr 6, 2011

I completed an application and got it to the point where it works fine. I had it setup on a local Access database and now I want to figure out how to connect it to a SQL server 2008 database. I got it setup to a point where the database is connected to app but not sure how to convert it.[code]

View 2 Replies

Call Random Line From Multiple Text Files?

Apr 22, 2009

I am making a basic form that has 1 button and a rich text box.I need to click on the button and have it call a random line from 3 text documents (so 3 lines total) and place them in the rich text box, each on a different line.

"Quick example"

3 Text files
Firstname.txt
Lastname.txt
Number.txt

Click on button named generate and in the text box below it places

First Name: Shara
Last Name: Harrow
Number: Seven

View 1 Replies

Importing All Files In A Folder (all Excel Files) Into A Single Table In An Access Database

Aug 23, 2011

I am trying to import a bunch of excel 2003 files all with A:H columns and they are under the same headings etc. into a table in access 2003 database. This is a module in access im making. Im using a file search to look for every file that begins with Format (which they all do ) to get at all the files in the folder path. is there a more efficient way to do this? somehow select all files in a folder? and import each to the same table in access? The DoCmd.TransferSpreadsheet seeems to take each file path individually so I'm not sure how to get each file name in the folder to import it.

I have this at the moment:

Sub Import()
Dim db As Database
Set db = CurrentDb

[Code].....

View 1 Replies







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