Quantcast
Channel: Visual Studio General Questions forum
Viewing all articles
Browse latest Browse all 21115

Visual basic equivalences

$
0
0

I am in the process of converting my VB 6.0 programs to VS 2010 (vb.net). I have been reading and reading  how to books and I'm getting so frustrated in this process that I'm thinking that vb.net is not what I want to be using.  Nevertheless, I'm still trying and I think if I could just get a few equivalent solutions completed, I will understand what is going on.  Many of my programs read sequential files and use the information in data bases for reference.  I use Access tables frequently in my 6.0 code and have become fairly competent using the tables.  I have been using the book, MS Visual Basic 2010, Step by Step by Michael Halvorson as my guide and I have read it from cover to cover.  But I'm still confused   For example, in my 6.0 code I use Public Functions and Subs to do much of my work, but in VS 2010 I keep getting that my statement is not valid in a Namespace.

Another example, VS 2010 removed the use of the TYPE statement and DIM SS as string * 3.  that is okay.  But if I want to read/write a fixed length record with using a single variable as defined by the TYPE variable, how can it be done.  Here is an example of what I did in 6.0:

Type AllFiles
    FileNo As Integer           ' 001 Number of file or Number of files in this file
    FileDesc As String * 42     ' 003 full folder name
    filename As String * 15     ' 045 name of file (prefix)
    FileExt As String * 3       ' 060 name extension (suffix) 
    FileFree As String * 2      ' 063 Free space
End Type                        ' 065

Public FilesRec As AllFiles

open filename for random as #1 len=len(AllFiles)

  get #1, rec, FilesRec

   or

  put #1, rec, FilesRec

close #1

This used to be so easy, but now it appears to be so complicated that I get lost.  I would love to see a VS 2010 equivalence code for the above code.

Then there is the accessing of data in the access tables.  In my reference book, there are examples of how to store a complete table onto a grid.  My problems are primarily using the data as opposed to listing it in a grid.   in VB6 I could open the table and then reference the fields of the table by their variable names like !Record or !FileNo. I didn't see any references to this process at all and it appears that a person needs to know a million different properties before he can do a simple read and write of an Access table.  This is obviously an exaggeration and I admit I'm still learning how to code in VS, but VB 6.0 code was at least logical in its operations and you didn't have to know hidden secrets.

I want to learn this and maybe even convert all my 6.0 programs to VS, but I can't understand why it has been made so difficult.  I guess I was hoping that when there wasn't a straight conversion from 6.0 to VS there would be a function or subroutine you can call to make it compatible.  If that process exists, that would be great, but I have not found one as yet.

I guess I sound like a ship without a rudder, but I'm hoping other people have gone through this process and can offer some assistance.

Thanks,

BigTeePhil

  

<object height="1" id="plugin0" style=";z-index:1000;" type="application/x-dgnria" width="1"><param name="tabId" value="{9024F5C1-E130-4819-A3CD-ECE8324E4FB7}" /></object>

Viewing all articles
Browse latest Browse all 21115

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>