473,378 Members | 1,594 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

VB6 Conversion. Need help understanding how to implement fixed length string arrays..

I am trying to convert a vb6 project to vb.net. The conversion worked for
the most part except for the fixed length strings and fixed length string
arrays. Bascially the vb6 programmer stored all form data in a fixed length
structure that is written direct to disk.

I need to load the existing files, into a fixed length structure to
initialize the form data within the project.

I am running into problems with statements like the following..

Original vb6 code looked something like:

Type formcfg
'General
CustId As String * 40
CellIdParam(0 To 7) As String * 8
end type

Public c As formcfg

The c structure is loaded with a routine like:

Open File$ For Random As #1 Len = Len(c)
Get #1, 1, c
Close #1

After converting to vb.net I see this code:
'UPGRADE_WARNING: Fixed-length string size must fit in the buffer. Click for
more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="3C1E4426-0B80-443E-B943-0627CD55D48B"'
<VBFixedString(40),
System.Runtime.InteropServices.MarshalAs(System.Ru ntime.InteropServices.UnmanagedType.ByValArray,
SizeConst:=41)Public CustId() As Char

and

'UPGRADE_ISSUE: Declaration type not supported: Array of fixed-length
strings. Click for more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="934BD4FF-1FF9-47BD-888F-D411E47E78FA"'

Dim TestParam(7) As String * 8

How do I recreate the functionallity that I need to work with these saved
structure files that are fixed length..? The fixed length strings have -1
appeneded to the end and therefore increase the size by 1. Is there a way
to handle this type of problem?
Thanks..

-Rick
Feb 16 '07 #1
1 9376
CustId As String * 40
CellIdParam(0 To 7) As String * 8

can change to

<VBFixedString(40)>Dim CustID As String
<VBFixedString(8)Dim CellIdParam(0 To 7) As String
-----
And
Dim TestParam(7) As String * 8

is

<VBFixedString(8)Dim TestParam(7) As String

VB.net really doesn't use fixed length strings since it allocates memory,
and in turn resources.

You can get away with....
Dim CustID As String
- or if you need the length
Dim CustID(40) As String

same with:
dim CellIdParam(0 To 7) As String

and
Dim TestParam(7) As String

Hope this helps.
"Rick Knospler" <no**********@skylands.netwrote in message
news:xT*****************@fe167.usenetserver.com...
>I am trying to convert a vb6 project to vb.net. The conversion worked for
the most part except for the fixed length strings and fixed length string
arrays. Bascially the vb6 programmer stored all form data in a fixed
length structure that is written direct to disk.

I need to load the existing files, into a fixed length structure to
initialize the form data within the project.

I am running into problems with statements like the following..

Original vb6 code looked something like:

Type formcfg
'General
CustId As String * 40
CellIdParam(0 To 7) As String * 8
end type

Public c As formcfg

The c structure is loaded with a routine like:

Open File$ For Random As #1 Len = Len(c)
Get #1, 1, c
Close #1

After converting to vb.net I see this code:
'UPGRADE_WARNING: Fixed-length string size must fit in the buffer. Click
for more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="3C1E4426-0B80-443E-B943-0627CD55D48B"'
<VBFixedString(40),
System.Runtime.InteropServices.MarshalAs(System.Ru ntime.InteropServices.UnmanagedType.ByValArray,
SizeConst:=41)Public CustId() As Char

and

'UPGRADE_ISSUE: Declaration type not supported: Array of fixed-length
strings. Click for more:
'ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?keyword="934BD4FF-1FF9-47BD-888F-D411E47E78FA"'

Dim TestParam(7) As String * 8

How do I recreate the functionallity that I need to work with these saved
structure files that are fixed length..? The fixed length strings have -1
appeneded to the end and therefore increase the size by 1. Is there a way
to handle this type of problem?
Thanks..

-Rick

Feb 16 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

30
by: Tim Johansson | last post by:
I'm new to C++, and tried to start making a script that will shuffle an array. Can someone please tell me what's wrong? #include <iostream.h> #include <string.h> int main () {...
7
by: guy | last post by:
Has anyone any experience of the conversion wizard for VB6 to VB2005? if so how good is it? also how does it handle database related conversions i.e is ADO converted to ADO.NET etc. the project...
19
by: ern | last post by:
I need a FIFO queue of size 20, to keep track of a running average. Once the queue is full with 20 values, I want to take the sum/20 = AVERAGE. Then when a new value comes in, I want: (Old Sum...
0
by: Ken Varn | last post by:
I have a managed C++ assembly in which I need to interact with some 'C' APIs that take fixed size 'C' data blocks. I need to wrap these data blocks into a managed object. It seems like a lot of...
11
by: jyck91 | last post by:
// Base Conversion // Aim: This program is to convert an inputted number // from base M into base N. Display the converted // number in base N. #include <stdio.h> #include <stdlib.h>...
3
sammyboy78
by: sammyboy78 | last post by:
I'm trying to display an array of objects using a GUI. My instructions are that the CD class and it's sublcass don't need to change I just need to modify class CDInventory to include the GUI. I'm not...
0
by: maheshmohta | last post by:
Background Often while remodeling legacy application, one of the important tasks for the architects is to have an optimum usage of storage capabilities of database. Most of the legacy applications...
43
by: John | last post by:
Hi This .net is driving me crazy!! In VB6 I had a type which contained a couple of multi-dimentional arrays which i used to create and read records: Type AAA : Array1(10,10,2) as Integer
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.